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
Ïà¹ØÎĵµ£º
1.ÄãÐèÒª¾«Í¨ÃæÏò¶ÔÏó·ÖÎöÓëÉè¼Æ(OOA/OOD)¡¢É漰ģʽ(GOF£¬J2EEDP)ÒÔ¼°×ÛºÏģʽ¡£ÄãÓ¦¸ÃÊ®·ÖÁ˽âUML£¬ÓÈÆäÊÇclass£¬object£¬interactionÒÔ¼°statediagrams¡£
¡¡¡¡2.ÄãÐèҪѧϰJAVAÓïÑԵĻù´¡ÖªÊ¶ÒÔ¼°ËüµÄºËÐÄÀà¿â(collections£¬serialization£¬streams£¬networking£¬ multithreadi ......
//ÅÅÐòºÍ²éÕÒÊÇÊý¾Ý½á¹¹ÓëËã·¨Éè¼ÆµÄÖØÒªÄÚÈÝ
/*
ÅÅÐòÖ÷Òª°üÀ¨
1.²åÈëÅÅÐò£ºÓÖ°üÀ¨Ö±½Ó²åÈëÅÅÐò¡¢¶þ·Ö·¨²åÈëÅÅÐò¡¢±í²åÈëÅÅÐò¡¢ShellÅÅÐò
2.Ñ¡ÔñÅÅÐò£º°üÀ¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò
3.½»»»ÅÅÐò£ºÃ°ÅÝÅÅÐò¡¢¿ìËÙÅÅÐò
4.·ÖÅäÅÅÐò£ºÖ÷ÒªÓлùÊýÅÅÐò
5.¹é²¢ÅÅÐò£ºÖ÷ÒªÓÐÄÚÅÅÐò¡¢ÍâÅÅÐò
×¢£ºÒÔϳÌÐò¾ùÔÚ±¾È˵çÄÔÉÏͨ¹ýÍêÕ ......
ÔÚ·Ö²¼Ê½·þÎñ¿ò¼ÜÖУ¬Ò»¸ö×î»ù´¡µÄÎÊÌâ¾ÍÊÇÔ¶³Ì·þÎñÊÇÔõôͨѶµÄ£¬ÔÚJavaÁìÓòÖÐÓкܶà¿ÉʵÏÖÔ¶³ÌͨѶµÄ¼¼Êõ£¬ÀýÈ磺RMI¡¢MINA¡¢ESB¡¢ Burlap¡¢Hessian¡¢SOAP¡¢EJBºÍJMS µÈ£¬ÕâЩÃû´ÊÖ®¼äµ½µ×ÊÇЩʲô¹ØϵÄØ£¬ËüÃDZ³ºóµ½µ×ÊÇ»ùÓÚʲôÔÀíʵÏÖµÄÄØ£¬Á˽âÕâЩÊÇʵÏÖ·Ö²¼Ê½·þÎñ¿ò¼ÜµÄ»ù´¡ÖªÊ¶£¬¶øÈç¹ûÔÚÐÔÄÜÉÏÓиߵÄÒªÇóµÄ»°£¬Ä ......
Ò»¡¢ ¶¨Òå
·ÅÔÚÒ»¸öÀàµÄÄÚ²¿µÄÀàÎÒÃǾͽÐÄÚ²¿Àà¡£
¶þ¡¢ ×÷ÓÃ
1.ÄÚ²¿Àà¿ÉÒԺܺõÄʵÏÖÒþ²Ø,Ò²¾ÍÊÇ·â×°ÐÔ¡£Ò»°ãµÄ·ÇÄÚ²¿À࣬ÊDz»ÔÊÐíÓÐ private ÓëprotectedȨÏ޵ģ¬µ«ÄÚ²¿Àà¿ÉÒÔ
2.ÄÚ²¿ÀàÓµÓÐÍâΧÀàµÄËùÓÐÔªËصķÃÎÊȨÏÞ
3.¿ÉÊÇʵÏÖ¶àÖؼ̳Ð
4.¿ÉÒÔ±ÜÃâÐ޸ĽӿڶøʵÏÖͬһ¸öÀàÖÐÁ½ÖÖͬÃû·½·¨µÄµ÷ÓÃ
Èý¡¢  ......
JavaỊ̈߳º¸ÅÄîÓëÔÀí
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢²Ù×÷ϵͳÖÐÏ̺߳ͽø³ÌµÄ¸ÅÄî
ÏÖÔڵIJÙ×÷ϵͳÊǶàÈÎÎñ²Ù×÷ϵͳ¡£¶àÏß³ÌÊÇʵÏÖ¶àÈÎÎñµÄÒ»ÖÖ·½Ê½¡£
½ø³ÌÊÇÖ¸Ò»¸öÄÚ´æÖÐÔËÐеÄÓ¦ÓóÌÐò£¬Ã¿¸ö½ø³Ì¶¼ÓÐ×Ô¼º¶ÀÁ¢µÄÒ»¿éÄÚ´æ¿Õ¼ä£¬Ò»¸ö½ø³ÌÖпÉÒÔÆô¶¯¶à¸öÏ̡߳£±ÈÈçÔÚWindowsϵͳÖУ¬Ò»¸öÔËÐеÄexe¾ÍÊÇÒ»¸ö½ø³Ì¡£
& ......