Java ¸´Ï°±Ê¼Ç_µÚ1Ìì
·½·¨µÄÖØÔØ
£ºÍ¬Ò»¸öÀàÀïÃæ·½·¨µÄÃû×ÖÏàͬ£¬·½·¨µÄ²ÎÊýÏÖ÷ÒªÊDzÎÊýÀàÐÍ£¬²ÎÊý¸öÊý£©
²»Í¬
,
·µ»ØÀàÐÍ¿ÉÄܲ»Í¬¡£
ÖØÔØ·½·¨¿ÉÒÔ¾ßÓв»Í¬µÄ·µ»ØÀàÐÍ£¬µ«·µ»ØÀàÐͱ¾Éí²»×ãÒÔÇø·Ö·½·¨µÄÁ½¸ö°æ
±¾¡£¹¹Ôì·½·¨Ò²¿ÉÒÔ±»ÖØÔØ¡£
·½·¨µÄÖØд
£º×ÓÀà¼Ì³Ð¸¸Àà
,
×ÓÀา¸ÇÁ˸¸ÀàµÄͬÃûͬ²Îͬ·µ»ØÖµµÄ·½·¨£¬×ÓÀàµÄ·ÃÎÊÐÞÊÎ
·û²»Äܱȸ¸ÀàµÄ·¶Î§Ð¡¡£
*
¸¸Àà
new
×ÓÀֻ࣬Äܵ÷ÓÃ×ÓÀàÖÐÖØдµÄ·½·¨£¬¶ø²»Äܵ÷ÓÃ×ÓÀàÀ©Õ¹µÄ·½·¨
¼Ì³ÐºÍ¶à̬
java
Êǵ¥Ò»¼Ì³Ð
,
½Ó¿ÚÆðµ½ÁËÀàËƶà¼Ì³ÐµÄ×÷Óá£
×ÓÀ಻Äܵ÷Óø¸Àà
private
µÄÊôÐԺͷ½·¨¡£
super
¹Ø¼ü×Ö£ºµ÷Óø¸ÀàµÄ·½·¨ºÍÊôÐÔ£¨¸¸Àà˽ÓеijýÍ⣩£¬Ð´ÔÚ×ÓÀàµÄ·½·¨µ÷
ÓÃ֮ǰ£¨µÚÒ»ÐУ©
*
¾²Ì¬·½·¨Àï²»ÄÜʹÓÃ
super
¹Ø¼ü×Ö
(
±ÈÈç
main
·½·¨Àï
)
*
¶à̬µÄʵÏÖ£ºÖØÔØ£¬ÖØд£¬½Ó¿Ú
*log4j
ÓÅÏȼ¶´Ó¸ßµ½µÍ£º
error,warn, info, debug
*
Òì³£——
Exception
Òì³£ÒªÔÚ×îºóÅ׳ö
*
Ò쳣ʱÏÈÖ´ÐÐ
finally
ÖеijÌÐòºóÖ´ÐÐ
return
ËÄÖÖ»ù±¾Êý¾ÝÀàÐ͵ÄÈ¡Öµ·¶Î§
£º
byte(-2^7~+2^7-1) short(-2^15~+2^15-1) ,int
ºÍ
long
µÄ·¶Î§ÒÀ´ËÀàÍÆ
Ïà¹ØÎĵµ£º
¶¨Òå:
SingletonģʽÖ÷Òª×÷ÓÃÊDZ£Ö¤ÔÚJavaÓ¦ÓóÌÐòÖУ¬Ò»¸öÀàClassÖ»ÓÐÒ»¸öʵÀý´æÔÚ¡£
Ôںܶà²Ù×÷ÖУ¬±ÈÈ罨Á¢Ä¿Â¼ Êý¾Ý¿âÁ¬½Ó¶¼ÐèÒªÕâÑùµÄµ¥Ï̲߳Ù×÷¡£
»¹ÓÐ, singletonÄܹ»±»×´Ì¬»¯;
ÕâÑù£¬¶à¸öµ¥Ì¬ÀàÔÚÒ»Æð¾Í¿ÉÒÔ×÷Ϊһ¸ö״̬²Ö¿âÒ»ÑùÏòÍâÌṩ·þÎñ£¬±ÈÈ磬ÄãÒªÂÛ̳ÖеÄÌû×Ó¼ÆÊýÆ÷£¬Ã¿´Îä¯ÀÀÒ»´ÎÐèÒª¼ÆÊý£¬µ¥Ì¬ÀàÄÜ·ñ ......
¹ØÓÚJavaµÄ»ù´¡ÖªÊ¶£¬Êµ¼ùÖ¤Ã÷ѧϰOO£¬×îÖÕÁìÎò“¸¸Àà¿ØÖÆÁ÷³Ì£¬×ÓÀàʵÏÖ¾ßÌåµÄÒµÎñÂß¼”µÄOO˼Ï룬ÐèÒªµÄ²»ÊÇÖÇÉ̶øÊÇ»ù´¡£¬Ò²¾ÍÊÇ˵£¬»ù´¡Ô½ºÃÔ½¿ìÁìÎò£¬ËùÒÔÇëÿλS1ѧϰJavaµÄѧԱÇëÀμÇÒÔÏÂJavaÁìÓòµÄ»ù´¡ÖªÊ¶£¬×îºó×£¸÷λѧԱÔÚ¿ª·¢ÏîÄ¿Ç°¿ÉÒÔÁìÎòOOµÄÕæÚУ¬ÀÏʦҲ»á½ß¾¡È«Á¦ÖúÄãÃÇ´òͨÕâµÀͨÏòJavaµÄ¼«ËÙ ......
½ñÌìºÍ´ó¼ÒÒ»ÆðѧϰJavaµÄÉè¼Æģʽ¡£±¾È˵Äˮƽ²»ÊǺܸߣ¬ÕâϵÁÐÎÄÕÂÖ»ÊÇ×Ô¼ºÑ§Ï°µÄ¹ý³Ì£¬²¢Ï£ÍûÄÜͬ´ó¼Ò·ÖÏí¾Ñé¡£
ÏÈ˵ÏÂÎÒ¶Ô¹¤³§Ä£Ê½µÄÀí½â£ºµ±ÎÒÃÇÐèҪij¸ö¶ÔÏóʱ£¬×îÖ±½ÓµÄ°ì·¨ÊÇ¿´µ½Õâ¸ö¶ÔÏó¾ÍÄùýÀ´¡£µ«Êǵ±¶ÔÏó·Ç³£¶àµÄʱºò£¬ÕÒÆðÀ´¾ÍºÜ²»·½±ã¡£Õâʱ¾ÍÐèÒªÒ»¸öÖнéÀ´°ïÖúÎÒÃÇÈ¡µÃÏëÒªµÄ¶«Î÷£¬Õâ¸öÖнé¾ÍÊǹ¤³§£¨fa ......
¹Ø¼ü×Ö: java.e800.com.cn/articles/2007/413/1176400876794405339_1.htm
http://java.e800.com.cn/articles/2007/413/1176400876794405339_1.html
±àÕß°´£ºJavaÄÚ´æй©ÊÇÿ¸öJava³ÌÐòÔ±¶¼»áÓöµ½µÄÎÊÌ⣬³ÌÐòÔÚ±¾µØÔËÐÐÒ»ÇÐÕý³££¬¿ÉÊDz¼Êðµ½Ô¶¶Ë¾Í»á³öÏÖÄÚ´æÎÞÏÞÖƵÄÔö³¤£¬×îºóϵͳ̱»¾£¬ÄÇôÈçºÎ×î¿ì×îºÃµÄ¼ì²â³ÌÐòµÄÎ ......