Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java¶àÏ̵߳ÄÏà¹Ø»úÖÆ[z]

 Ò» Ï̵߳Ļù±¾¸ÅÄî
Ïß³ÌÊÇÒ»¸ö³ÌÐòÄÚ²¿µÄ˳Ðò¿ØÖÆÁ÷.Ò»¸ö½ø³ÌÏ൱ÓÚÒ»¸öÈÎÎñ,Ò»¸öÏß³ÌÏ൱ÓÚÒ»¸öÈÎÎñÖеÄÒ»ÌõÖ´Ðз¾¶.£»¶à½ø³Ì:ÔÚ²Ù×÷ϵͳÖÐÄÜͬʱÔËÐжà¸öÈÎÎñ (³ÌÐò)£»¶àÏß³Ì:ÔÚͬһ¸öÓ¦ÓóÌÐòÖÐÓжà¸ö˳ÐòÁ÷ͬʱִÐУ»JavaµÄÏß³ÌÊÇͨ¹ýjava.lang.ThreadÀàÀ´ÊµÏֵģ»JVMÆô¶¯Ê±»áÓÐÒ»¸öÓÉÖ÷·½·¨(public static void main(){})Ëù¶¨ÒåµÄỊ̈߳»¿ÉÒÔͨ¹ý´´½¨ThreadµÄʵÀýÀ´´´½¨ÐµÄỊ̈߳»Ã¿¸öÏ̶߳¼ÊÇͨ¹ýij¸öÌض¨Thread¶ÔÏóËù¶ÔÓ¦µÄ·½·¨run()À´Íê³ÉÆä²Ù×÷µÄ,·½·¨run()³ÆΪÏß³ÌÌ壬ͨ¹ýµ÷ÓÃThreadÀàµÄstart()·½·¨À´Æô¶¯Ò»¸öÏ̡߳£
¶þ Ï̵߳Ĵ´½¨ºÍÆô¶¯
¿ÉÒÔÓÐÁ½ÖÖ·½Ê½´´½¨ÐµÄÏß³Ì:
µÚÒ»ÖÖ:
1.¶¨ÒåÏß³ÌÀàʵÏÖRunnable½Ó¿Ú
2.Thread myThread = new Thread(target);   //targetΪRunnable½Ó¿ÚÀàÐÍ
3.RunnableÖÐÖ»ÓÐÒ»¸ö·½·¨:public void run();ÓÃÒÔ¶¨ÒåÏß³ÌÔËÐÐÌå
4.ʹÓÃRunnable½Ó¿Ú¿ÉÒÔΪ¶à¸öÏß³ÌÌṩ¹²ÏíµÄÊý¾Ý
5.ÔÚʵÏÖRunnable½Ó¿ÚµÄÀàµÄrun()·½·¨¶¨ÒåÖпÉÒÔʹÓÃThreadµÄ¾²Ì¬·½·¨public static Thread currentThread();»ñÈ¡µ±Ç°Ï̵߳ÄÒýÓÃ
µÚ¶þÖÖ:
1.¿ÉÒÔ¶¨ÒåÒ»¸öThreadµÄ×ÓÀಢÖØдÆärun·½·¨Èç:
class MyThread extends Thread {   
public void run() {...}
}   
2.È»ºóÉú³É¸ÃÀàµÄ¶ÔÏó:
MyThread myThread = new MyThread();
Èý Ï߳̿ØÖƵĻù±¾·½·¨
isAlive():ÅжÏÏß³ÌÊÇ·ñ»¹"»î"×Å
getPriority():»ñµÃÏ̵߳ÄÓÅÏȼ¶ÊýÖµ
setPriority():ÉèÖÃÏ̵߳ÄÓÅÏȼ¶ÊýÖµ
Thread.sleep():½«µ±Ç°Ïß³Ì˯ÃßÖ¸¶¨ºÁÃëÊý
join():µ÷ÓÃijÏ̵߳ĸ÷½·¨,½«µ±Ç°Ïß³ÌÓë¸ÃÏß³Ì"ºÏ²¢",¼´µÈ´ý¸ÃÏ߳̽áÊø,ÔÙ»Ö¸´µ±Ç°Ï̵߳ÄÔËÐÐ
yield():Èóöcpu,µ±Ç°Ï߳̽øÈë¾ÍÐ÷¶ÓÁеȴýµ÷¶È
wait():µ±Ç°Ï߳̽øÈë¶ÔÏóµÄwait pool
notify()/notifyAll():»½ÐѶÔÏóµÄwait poolÖеÄÒ»¸ö/ËùÓеȴýÏß³Ì
Ò» Ï̵߳Ļù±¾¸ÅÄî
Ïß³ÌÊÇÒ»¸ö³ÌÐòÄÚ²¿µÄ˳Ðò¿ØÖÆÁ÷.Ò»¸ö½ø³ÌÏ൱ÓÚÒ»¸öÈÎÎñ,Ò»¸öÏß³ÌÏ൱ÓÚÒ»¸öÈÎÎñÖеÄÒ»ÌõÖ´Ðз¾¶.£»¶à½ø³Ì:ÔÚ²Ù×÷ϵͳÖÐÄÜͬʱÔËÐжà¸öÈÎÎñ (³ÌÐò)£»¶àÏß³Ì:ÔÚͬһ¸öÓ¦ÓóÌÐòÖÐÓжà¸ö˳ÐòÁ÷ͬʱִÐУ»JavaµÄÏß³ÌÊÇͨ¹ýjava.lang.ThreadÀàÀ´ÊµÏֵģ»JVMÆô¶¯Ê±»áÓÐÒ»¸öÓÉÖ÷·½·¨(public static void main(){})Ëù¶¨ÒåµÄỊ̈߳»¿ÉÒÔͨ¹ý´´½¨ThreadµÄʵÀýÀ´´´½¨ÐµÄỊ̈߳»Ã¿¸öÏ̶߳¼ÊÇͨ¹ýij¸öÌض¨Thread¶ÔÏóËù¶ÔÓ¦µÄ·½·¨run()À´Íê³ÉÆä²Ù×÷µÄ,·½·¨run()³ÆΪÏß³ÌÌ壬ͨ¹ýµ÷ÓÃThreadÀàµÄstart()·½·¨À´Æô¶¯Ò»¸öÏ̡߳£


Ïà¹ØÎĵµ£º

javaÓÎÏ·Ö÷ÒªµÄ¼¼Êõ

1£¬Java3D ×÷Ϊsun¹«Ë¾½ÏÔçÍƳöµÄÒ»Ïî3d¼¼Êõ£¬ÊÇÒ»Öָ߶ȷâ×°µÄapi£¬¹¹½¨ÔÚopenglºÍdirect3dÖ®ÉÏ£¬¿ÉÒÔ˵ÊÇ×îÓÐÃûµÄjavaµÄ3d¼¼Êõ¡£ÓÉÓÚÖÖÖÖÔ­Òò£¨apiÉè¼Æ£¬ÃæÏòµÄÓû§²»Ã÷È·£©£¬java3dһֱûÓа취Á÷ÐУ¬²»¾ÃÇ°java3dµÄÍŶÓÐû²¼ÔÝÍ£¶Ôjava3dй¦ÄܵĿª·¢£¬×ª¶øΪJavaFX¿ª·¢3d äÖȾÒýÇ档ͬʱsunµÄÁíÒ»¸öÏîÄ¿ project wonder ......

javaʵÏÖµÄftpÎļþÉÏ´«ÀýÌâ

1£ºÓÃhttpЭÒéÉÏ´«¸üÊʺÏweb±à³ÌµÄ·½±ã£»´«Ð¡ÓÚ1MÎļþËÙ¶ÈÒª±ÈÓÃftpЭÒéÉÏ´«ÎļþÂÔ¿ì¡£°²È«ÐԺ㻲»ÏñftpÄÇÑù£»±ØÐëÒªÆô¶¯Ò»¸öftp·þÎñ²ÅÐС£
2£ºÓÃftpЭÒéÉÏ´«Îļþ´óÓÚ1MµÄÎļþËٶȱÈhttp¿ì£»ÎļþÔ½´ó£»ÉÏ´«µÄËٶȾͱÈhttpÉÏ´«¿ìµÄ±¶ÊýÔ½´ó¡£¶øÇÒÓÃjava±àд³ÌÐò£»ftp±Èhttp·½±ã¡£ºÃ£¬·Ï»°ÉÙ˵£»ÎÒÃÇÏȴһ¸öʵÀýÀ´ÀíÐÔÈÏ ......

Çë¸÷λ¸ßÊÖ²»Áߴͽ̣¬JAVA³ÌÐòÎÊÌâ

 ×ܹ²Á½¸öÎļþTaxTest.javaÓëTax.java
---------------------------------------------------------------------------------------
TaxTest.java
===========================================
import javax.swing.JOptionPane;
public class TestTax{
public static void main(String[] args){
String yea ......

Java±¾ÖÊÂÛÖ®¹ØÓÚJavaÕ»Óë¶ÑµÄ˼¿¼

 ×ªÌù×Ô http://www.3800hk.com/Article/cxsj/java/jcjcjave/2009-11-10/Article_181759.html
¡¡1. Õ»(stack)Óë¶Ñ(heap)¶¼ÊÇJavaÓÃÀ´ÔÚRamÖдæ·ÅÊý¾Ý
µÄµØ·½¡£ÓëC++²»Í¬£¬Java×Ô¶¯
ÖÎÀíÕ»ºÍ¶Ñ£¬³ÌÐòÔ±²»ÄÜÖ±½ÓµØÉèÖÃÕ»»ò¶Ñ¡£
¡¡¡¡
¡¡¡¡2. Õ»µÄÓÅÊÆÊÇ£¬´æÈ¡ËٶȱȶÑÒª¿ì£¬½ö´ÎÓÚÖ±½ÓλÓÚCPUÖеļĴæÆ÷¡£µ«È±µãÊÇ£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ