JavaỊ̈߳ºÏ̵߳Ľ»»¥
JavaỊ̈߳ºÏ̵߳Ľ»»¥
SCJP5ѧϰ±Ê¼Ç
Ï߳̽»»¥ÊDZȽϸ´ÔÓµÄÎÊÌ⣬SCJPÒªÇ󲻺ܻù´¡£º¸ø¶¨Ò»¸ö³¡¾°£¬±àд´úÂëÀ´Ç¡µ±Ê¹Óõȴý¡¢Í¨ÖªºÍ֪ͨËùÓÐÏ̡߳£
Ò»¡¢Ï߳̽»»¥µÄ»ù´¡ÖªÊ¶
SCJPËùÒªÇóµÄÏ߳̽»»¥ÖªÊ¶µãÐèÒª´Ójava.lang.ObjectµÄÀàµÄÈý¸ö·½·¨À´Ñ§Ï°£º
void notify()
»½ÐÑÔڴ˶ÔÏó¼àÊÓÆ÷ÉϵȴýµÄµ¥¸öÏ̡߳£
void notifyAll()
»½ÐÑÔڴ˶ÔÏó¼àÊÓÆ÷ÉϵȴýµÄËùÓÐÏ̡߳£
void wait()
µ¼Öµ±Ç°µÄÏ̵߳ȴý£¬Ö±µ½ÆäËûÏ̵߳÷Óô˶ÔÏóµÄ notify() ·½·¨»ò notifyAll() ·½·¨¡£
µ±È»£¬wait()»¹ÓÐÁíÍâÁ½¸öÖØÔØ·½·¨£º
void wait(long timeout)
µ¼Öµ±Ç°µÄÏ̵߳ȴý£¬Ö±µ½ÆäËûÏ̵߳÷Óô˶ÔÏóµÄ notify() ·½·¨»ò notifyAll() ·½·¨£¬»òÕß³¬¹ýÖ¸¶¨µÄʱ¼äÁ¿¡£
void wait(long timeout, int nanos)
µ¼Öµ±Ç°µÄÏ̵߳ȴý£¬Ö±µ½ÆäËûÏ̵߳÷Óô˶ÔÏóµÄ notify() ·½·¨»ò notifyAll() ·½·¨£¬»òÕßÆäËûij¸öÏß³ÌÖжϵ±Ç°Ị̈߳¬»òÕßÒѳ¬¹ýij¸öʵ¼Êʱ¼äÁ¿¡£
ÒÔÉÏÕâЩ·½·¨ÊÇ°ïÖúÏ̴߳«µÝÏ̹߳ØÐĵÄʱ¼ä״̬¡£
¹ØÓڵȴý/֪ͨ£¬Òª¼ÇסµÄ¹Ø¼üµãÊÇ£º
±ØÐë´Óͬ²½»·¾³ÄÚµ÷ÓÃwait()¡¢notify()¡¢notifyAll()·½·¨¡£Ï̲߳»Äܵ÷ÓöÔÏóÉϵȴý»ò֪ͨµÄ·½·¨£¬³ý·ÇËüÓµÓÐÄǸö¶ÔÏóµÄËø¡£
wait()¡¢notify()¡¢notifyAll()¶¼ÊÇObjectµÄʵÀý·½·¨¡£Óëÿ¸ö¶ÔÏó¾ßÓÐËøÒ»Ñù£¬Ã¿¸ö¶ÔÏó¿ÉÒÔÓÐÒ»¸öÏß³ÌÁÐ±í£¬ËûÃǵȴýÀ´×Ô¸ÃÐźţ¨Í¨Öª£©¡£Ïß³Ìͨ¹ýÖ´ÐжÔÏóÉϵÄwait()·½·¨»ñµÃÕâ¸öµÈ´ýÁÐ±í¡£´ÓÄÇʱºòÆð£¬Ëü²»ÔÙÖ´ÐÐÈκÎÆäËûÖ¸Áֱµ½µ÷ÓöÔÏóµÄnotify()·½·¨ÎªÖ¹¡£Èç¹û¶à¸öÏß³ÌÔÚͬһ¸ö¶ÔÏóÉϵȴý£¬Ôò½«Ö»Ñ¡ÔñÒ»¸öỊ̈߳¨²»±£Ö¤ÒÔºÎÖÖ˳Ðò£©¼ÌÐøÖ´ÐС£Èç¹ûûÓÐÏ̵߳ȴý£¬Ôò²»²ÉÈ¡ÈκÎÌØÊâ²Ù×÷¡£
ÏÂÃæ¿´¸öÀý×Ó¾ÍÃ÷°×ÁË£º
/**
* ¼ÆËãÊä³öÆäËûÏß³ÌËø¼ÆËãµÄÊý¾Ý
*
* @author leizhimin 2008-9-15 13:20:38
*/
public class ThreadA {
public static void main(String[] args) {
ThreadB b = new
Ïà¹ØÎĵµ£º
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
¡¡¡¡Ò»¡¢Java±à³ÌÈëÃÅÀà
¡¡¡¡¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄJava³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé ......
java -verbose[:class|gc|jni] ÔÚÊä³öÉ豸ÉÏÏÔʾÐéÄâ»úÔËÐÐÐÅÏ¢¡£
1.java -verbose:class
ÔÚ³ÌÐòÔËÐеÄʱºò¾¿¾¹»áÓжàÉÙÀà±»¼ÓÔØÄØ£¬Ò»¸ö¼òµ¥³ÌÐò»á¼ÓÔØÉÏ°Ù¸öÀàµÄ£¡Äã¿ÉÒÔÓÃverbose:classÀ´¼àÊÓ£¬ÔÚÃüÁîÐÐÊäÈëjava -verbose:class XXX (XXXΪ³ÌÐòÃû)Äã»áÔÚ¿ØÖÆ̨¿´µ½¼ÓÔصÄÀàµÄÇé¿ö¡£
verboseºÍverbose:cla ......
´ò¿ªeclipse£¬·¢ÏÖeclipseå´µôÁË£¬²¢ÇÒ³öÏÖÕâÑùµÄÌáʾ£º¹ØÓÚInitializing java tooling£¨1%£©...
ÖØÆôÁ˼¸´ÎÖ®ºó·¢ÏÖÎÊÌâÈÔÈ»´æÔÚ£¬Òò¶ø¿ñËÑÁËÒ»°Ñ£¬ÖÕÓÚÕÒµ½ÕýÈ·µÄ½â¾ö°ì·¨£¬ÈçÏ£º
ÕÒµ½eclipseĿ¼£¬±à¼eclipse.iniÎļþ£¬ÔÚ-vmargs²ÎÊý֮ǰÌí¼ÓÉÏÈçϲÎÊý£¨Ò»¶¨ÒªÏñÏÂÃæÕâÑùд³ÉÁ½ÐУ©£¬È»ºóÖØÆô¾ÍokÁË
-vm
C:\Progr ......
JavaỊ̈߳º¸ÅÄîÓëÔÀí
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢²Ù×÷ϵͳÖÐÏ̺߳ͽø³ÌµÄ¸ÅÄî
ÏÖÔڵIJÙ×÷ϵͳÊǶàÈÎÎñ²Ù×÷ϵͳ¡£¶àÏß³ÌÊÇʵÏÖ¶àÈÎÎñµÄÒ»ÖÖ·½Ê½¡£
½ø³ÌÊÇÖ¸Ò»¸öÄÚ´æÖÐÔËÐеÄÓ¦ÓóÌÐò£¬Ã¿¸ö½ø³Ì¶¼ÓÐ×Ô¼º¶ÀÁ¢µÄÒ»¿éÄÚ´æ¿Õ¼ä£¬Ò»¸ö½ø³ÌÖпÉÒÔÆô¶¯¶à¸öÏ̡߳£±ÈÈçÔÚWindowsϵͳÖУ¬Ò»¸öÔËÐеÄexe¾ÍÊÇÒ»¸ö½ø³Ì¡£
&nb ......
JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
SCJP5ѧϰ±Ê¼Ç
ÒªÀí½âÏ̵߳÷¶ÈµÄÔÀí£¬ÒÔ¼°Ïß³ÌÖ´Ðйý³Ì£¬±ØÐëÀí½âÏß³ÌջģÐÍ¡£
Ïß³ÌÕ»ÊÇָijʱ¿ÌʱÄÚ´æÖÐÏ̵߳÷¶ÈµÄÕ»ÐÅÏ¢£¬µ±Ç°µ÷Óõķ½·¨×ÜÊÇλÓÚÕ»¶¥¡£Ïß³ÌÕ»µÄÄÚÈÝÊÇËæ×ųÌÐòµÄÔËÐж¯Ì¬±ä»¯µÄ£¬Òò´ËÑо¿Ïß³ÌÕ»±ØÐëÑ¡ÔñÒ»¸öÔËÐеÄʱ¿Ì£¨Êµ¼ÊÉÏÖ¸´úÂëÔËÐе½Ê²Ã´µØ· ......