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

JavaỊ̈߳ºÏ̵߳Äͬ²½ ͬ²½·½·¨

JavaỊ̈߳ºÏ̵߳Äͬ²½-ͬ²½·½·¨
 
Ï̵߳Äͬ²½ÊDZ£Ö¤¶àḬ̈߳²È«·ÃÎʾºÕù×ÊÔ´µÄÒ»ÖÖÊֶΡ£
Ï̵߳Äͬ²½ÊÇJava¶àÏ̱߳à³ÌµÄÄѵ㣬ÍùÍù¿ª·¢Õ߸㲻Çå³þʲôÊǾºÕù×ÊÔ´¡¢Ê²Ã´Ê±ºòÐèÒª¿¼ÂÇͬ²½£¬Ôõôͬ²½µÈµÈÎÊÌ⣬µ±È»£¬ÕâЩÎÊÌâûÓкÜÃ÷È·µÄ´ð°¸£¬µ«ÓÐЩԭÔòÎÊÌâÐèÒª¿¼ÂÇ£¬ÊÇ·ñÓоºÕù×ÊÔ´±»Í¬Ê±¸Ä¶¯µÄÎÊÌ⣿
 
ÔÚ±¾ÎÄ֮ǰ£¬Çë²ÎÔÄ¡¶JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø¡·£¬±¾ÎÄÊÇÔÚ´Ë»ù´¡ÉÏËùдµÄ¡£
 
¶ÔÓÚͬ²½£¬ÔÚ¾ßÌåµÄJava´úÂëÖÐÐèÒªÍê³ÉÒ»ÏÂÁ½¸ö²Ù×÷£º
°Ñ¾ºÕù·ÃÎʵÄ×ÊÔ´±êʶΪprivate£»
ͬ²½ÄÄЩÐ޸ıäÁ¿µÄ´úÂ룬ʹÓÃsynchronized¹Ø¼ü×Öͬ²½·½·¨»ò´úÂë¡£
µ±È»Õâ²»ÊÇΨһ¿ØÖƲ¢·¢°²È«µÄ;¾¶¡£
 
synchronized¹Ø¼ü×ÖʹÓÃ˵Ã÷
synchronizedÖ»Äܱê¼Ç·Ç³éÏóµÄ·½·¨£¬²»Äܱêʶ³ÉÔ±±äÁ¿¡£
 
ΪÁËÑÝʾͬ²½·½·¨µÄʹÓ㬹¹½¨ÁËÒ»¸öÐÅÓÿ¨ÕË»§£¬Æð³õÐÅÓöîΪ100w£¬È»ºóÄ£Äâ͸֧¡¢´æ¿îµÈ¶à¸ö²Ù×÷¡£ÏÔÈ»ÒøÐÐÕË»§User¶ÔÏóÊǸö¾ºÕù×ÊÔ´£¬¶ø¶à¸ö²¢·¢²Ù×÷µÄÊÇÕË»§·½·¨oper(int x)£¬µ±È»Ó¦¸ÃÔÚ´Ë·½·¨ÉϼÓÉÏͬ²½£¬²¢½«ÕË»§µÄÓà¶îÉèΪ˽ÓбäÁ¿£¬½ûÖ¹Ö±½Ó·ÃÎÊ¡£
 
 
/**
* JavaỊ̈߳ºÏ̵߳Äͬ²½
*
* @author leizhimin 2009-11-4 11:23:32
*/
public class Test {
        public static void main(String[] args) {
                User u = new User("ÕÅÈý", 100);
                MyThread t1 = new MyThread("Ïß³ÌA", u, 20);
                MyThread t2 = new MyThread("Ïß³ÌB", u, -60);
                MyThread t3 = new MyThread("Ïß³ÌC", u, -80);
                MyThread t4 = new MyThread("Ïß³ÌD", u, -30);
                MyThread t5 = new MyThread("Ïß³ÌE", u, 32);
       &nbs


Ïà¹ØÎĵµ£º

Javaƽ̨I18N Ö§³Ö¸ÅÊö

Ò»¡¢¹ú¼Ê»¯ºÍ Java ±à³ÌÓïÑÔ
 
ºÍ´ó¶àÊýʹÓÃÆäËüÓïÑԵijÌÐòÔ±²»Í¬£¬Java
³ÌÐòÔ±ÊÇ´óÁ¿¹¹½¨ÔÚ JDK ÖÐÌṩ I18N Ö§³ÖµÄ±ê×¼´úÂëµÄÊÜÒæÕß¡£´ó²¿·Ö´úÂë×î³õÀ´×Ô IBM µÄ Taligent ×Ó¹«Ë¾£¨×ԴӺϲ¢½ø
IBM ÒԺ󣩣¬´ú±íÁËÐí¶àÈËÄêµÄ¹¤×÷³É¹û£¬±È´ó¶àÊý¹«Ë¾¶À×ÔÔÚÆä²úÆ·ÖÐÌṩµÄ´úÂëÒªÇÐʵ¿ÉÐеöࡣ
 
ÕâЩ
´úÂë ......

JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿

JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
 
SCJP5ѧϰ±Ê¼Ç
 
ÒªÀí½âÏ̵߳÷¶ÈµÄÔ­Àí£¬ÒÔ¼°Ïß³ÌÖ´Ðйý³Ì£¬±ØÐëÀí½âÏß³ÌջģÐÍ¡£
Ïß³ÌÕ»ÊÇָijʱ¿ÌʱÄÚ´æÖÐÏ̵߳÷¶ÈµÄÕ»ÐÅÏ¢£¬µ±Ç°µ÷Óõķ½·¨×ÜÊÇλÓÚÕ»¶¥¡£Ïß³ÌÕ»µÄÄÚÈÝÊÇËæ×ųÌÐòµÄÔËÐж¯Ì¬±ä»¯µÄ£¬Òò´ËÑо¿Ïß³ÌÕ»±ØÐëÑ¡ÔñÒ»¸öÔËÐеÄʱ¿Ì£¨Êµ¼ÊÉÏÖ¸´úÂëÔËÐе½Ê²Ã´µØ· ......

JavaỊ̈߳ºÏ̵߳ĵ÷¶È Èò½

JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
 
Ï̵߳ÄÈò½º¬Òå¾ÍÊÇʹµ±Ç°ÔËÐÐ×ÅÏß³ÌÈóöCPU×ÊÔ´£¬µ«ÊÇÈ»¸øË­²»ÖªµÀ£¬½ö½öÊÇÈóö£¬Ïß³Ì״̬»Øµ½¿ÉÔËÐÐ״̬¡£
 
Ï̵߳ÄÈò½Ê¹ÓÃThread.yield()·½·¨£¬yield() Ϊ¾²Ì¬·½·¨£¬¹¦ÄÜÊÇÔÝÍ£µ±Ç°ÕýÔÚÖ´ÐеÄÏ̶߳ÔÏ󣬲¢Ö´ÐÐÆäËûÏ̡߳£
 
/**
* JavaỊ̈߳ºÏ̵߳ĵ÷¶È-Èò½
*
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ