JavaỊ̈߳ºÏ̵߳ĵ÷¶È ºÏ²¢
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ºÏ²¢
Ï̵߳ĺϲ¢µÄº¬Òå¾ÍÊǽ«¼¸¸ö²¢ÐÐÏ̵߳ÄÏ̺߳ϲ¢ÎªÒ»¸öµ¥Ïß³ÌÖ´ÐУ¬Ó¦Óó¡¾°Êǵ±Ò»¸öÏ̱߳ØÐëµÈ´ýÁíÒ»¸öÏß³ÌÖ´ÐÐÍê±Ï²ÅÄÜÖ´ÐÐʱ¿ÉÒÔʹÓÃjoin·½·¨¡£
joinΪ·Ç¾²Ì¬·½·¨£¬¶¨ÒåÈçÏ£º
void join()
µÈ´ý¸ÃÏß³ÌÖÕÖ¹¡£
void join(long millis)
µÈ´ý¸ÃÏß³ÌÖÕÖ¹µÄʱ¼ä×Ϊ millis ºÁÃë¡£
void join(long millis, int nanos)
µÈ´ý¸ÃÏß³ÌÖÕÖ¹µÄʱ¼ä×Ϊ millis ºÁÃë + nanos ÄÉÃë¡£
/**
* JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ºÏ²¢
*
* @author leizhimin 2009-11-4 9:02:40
*/
public class Test {
public static void main(String[] args) {
Thread t1 = new MyThread1();
t1.start();
for (int i = 0; i < 20; i++) {
System.out.println("Ö÷Ï̵߳Ú" + i + "´ÎÖ´ÐУ¡");
if (i > 2) try {
//t1Ï̺߳ϲ¢µ½Ö÷Ïß³ÌÖУ¬Ö÷Ïß³ÌÍ£Ö¹Ö´Ðйý³Ì£¬×ª¶øÖ´ÐÐt1Ị̈߳¬Ö±µ½t1Ö´ÐÐÍê±Ïºó¼ÌÐø¡£
t1.j
Ïà¹ØÎĵµ£º
1.Ì⣺javaÀúÊ·£¿
´ð£ºJava Ö®¸¸Golsling
1995 Äê5 ÔÂ23 ÈÕ Java µ®Éú
1998 Äê12 ÔÂ 1.2 °æ±¾Java2 J2SE J2EE J2ME
2004 Äê12 ÔÂ 1.5 °æ±¾(5.0) Java JavaSE JavaEE JavaME
2.Ì⣺JavaSE£¬JavaEE£¬JavaME£¿
´ð£ºJavaSE ---Java ±ê׼ƽ̨
JavaEE ---ÆóÒµ¼ ......
½ñÌì°ÑÒÔǰдµÄjava´úÂëÄóöÀ´£¬·¢ÏÖ³öÁ˺öà´íÎó¡£µ÷ÁË°ëÌ죬·¢ÏÖÊÇ°æ±¾µÄÎÊÌ⣬ÓôÃÆ£¡
¿ÉÄÜ֮ǰÎÒд´úÂëµÄʱºòÓõÄÊÇJDK1.5£¬½ñÌì´ÓÍøÉÏÏÂÔØJDK1.6£¬Ã»³É¹¦¡£¾Í²Ý²ÝÏÂÔØÁËJDK1.5,½á¹û×ÜÊÇÌáʾ“could not find the main class. program will exit”¡£ÎҾ͵½
window-¡·preference-¡·java-¡·compiler°Ñµ±Ç°µÄ°æ ......
JavaỊ̈߳º¸ÅÄîÓëÔÀí
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢²Ù×÷ϵͳÖÐÏ̺߳ͽø³ÌµÄ¸ÅÄî
ÏÖÔڵIJÙ×÷ϵͳÊǶàÈÎÎñ²Ù×÷ϵͳ¡£¶àÏß³ÌÊÇʵÏÖ¶àÈÎÎñµÄÒ»ÖÖ·½Ê½¡£
½ø³ÌÊÇÖ¸Ò»¸öÄÚ´æÖÐÔËÐеÄÓ¦ÓóÌÐò£¬Ã¿¸ö½ø³Ì¶¼ÓÐ×Ô¼º¶ÀÁ¢µÄÒ»¿éÄÚ´æ¿Õ¼ä£¬Ò»¸ö½ø³ÌÖпÉÒÔÆô¶¯¶à¸öÏ̡߳£±ÈÈçÔÚWindowsϵͳÖУ¬Ò»¸öÔËÐеÄexe¾ÍÊÇÒ»¸ö½ø³Ì¡£
&nb ......
JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø
Ò»¡¢Í¬²½ÎÊÌâÌá³ö
Ï̵߳Äͬ²½ÊÇΪÁË·ÀÖ¹¶à¸öÏ̷߳ÃÎÊÒ»¸öÊý¾Ý¶ÔÏóʱ£¬¶ÔÊý¾ÝÔì³ÉµÄÆÆ»µ¡£
ÀýÈ磺Á½¸öÏß³ÌThreadA¡¢ThreadB¶¼²Ù×÷ͬһ¸ö¶ÔÏóFoo¶ÔÏ󣬲¢ÐÞ¸ÄFoo¶ÔÏóÉϵÄÊý¾Ý¡£
public class Foo {
private int x = 100;
......
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
Ï̵߳ÄÈò½º¬Òå¾ÍÊÇʹµ±Ç°ÔËÐÐ×ÅÏß³ÌÈóöCPU×ÊÔ´£¬µ«ÊÇÈ»¸ø˲»ÖªµÀ£¬½ö½öÊÇÈóö£¬Ïß³Ì״̬»Øµ½¿ÉÔËÐÐ״̬¡£
Ï̵߳ÄÈò½Ê¹ÓÃThread.yield()·½·¨£¬yield() Ϊ¾²Ì¬·½·¨£¬¹¦ÄÜÊÇÔÝÍ£µ±Ç°ÕýÔÚÖ´ÐеÄÏ̶߳ÔÏ󣬲¢Ö´ÐÐÆäËûÏ̡߳£
/**
* JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
*
......