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

ÓйØjavaÖеÄÒýÓÃÎÊÌâ

Ê×ÏÈ£¬java¶Ô¶ÔÏóºÍ»ù±¾ÀàÐ͵Ĵ¦ÀíÊDz»Ò»ÑùµÄ£¬ºÍCÓïÑÔÒ»Ñù£¬µ±°ÑJavaµÄ»ù±¾Êý¾ÝÀàÐÍ£¨Èçint£¬char£¬doubleµÈ£©×÷ΪÈë¿Ú²ÎÊý´«¸øº¯ÊýÌåµÄʱºò£¬´«ÈëµÄ²ÎÊýÔÚº¯ÊýÌåÄÚ²¿±ä³ÉÁ˾ֲ¿±äÁ¿£¬Õâ¸ö¾Ö²¿±äÁ¿ÊÇÊäÈë²ÎÊýµÄÒ»¸ö¿½±´£¬ËùÓеĺ¯ÊýÌåÄÚ²¿µÄ²Ù×÷¶¼ÊÇÕë¶ÔÕâ¸ö¿½±´µÄ²Ù×÷£¬º¯ÊýÖ´ÐнáÊøºó£¬Õâ¸ö¾Ö²¿±äÁ¿Ò²¾ÍÍê³ÉÁËËüµÄʹÃü£¬ËüÓ°Ïì²»µ½×÷ΪÊäÈë²ÎÊýµÄ±äÁ¿¡£ÕâÖÖ·½Ê½µÄ²ÎÊý´«µÝ±»³ÆΪ"Öµ´«µÝ"¡£¶øÔÚJavaÖÐÓöÔÏóµÄ×÷ΪÈë¿Ú²ÎÊýµÄ´«µÝÔòȱʡΪ"ÒýÓô«µÝ"£¬Ò²¾ÍÊÇ˵½ö½ö´«µÝÁ˶ÔÏóµÄÒ»¸ö"ÒýÓÃ"£¬Õâ¸ö"ÒýÓÃ"µÄ¸ÅÄîͬCÓïÑÔÖеÄÖ¸ÕëÒýÓÃÊÇÒ»ÑùµÄ¡£µ±º¯ÊýÌåÄÚ²¿¶ÔÊäÈë±äÁ¿¸Ä±äʱ£¬ÊµÖÊÉϾÍÊÇÔÚ¶ÔÕâ¸ö¶ÔÏóµÄÖ±½Ó²Ù×÷¡£
´ËÍ⣬ÔÚÈκÎÓÓ£½”Ïò¶ÔÏó±äÁ¿¸³ÖµµÄʱºò¶¼ÊÇ"ÒýÓô«µÝ"¡£È磺
package reference;
class PassObj
{
String str = "init value";
}
public class ObjPassValue
{
public static void main(String[] args)
{
PassObj objA = new PassObj();
PassObj objB = objA;
objA.str = "changed in objA";
System.out.println("Print objB.str value: " + objB.str);
}
}
/* RUN RESULT
Print objB.str value: changed in objA
*/
µÚÒ»¾äÊÇÔÚÄÚ´æÖÐÉú³ÉÒ»¸öеÄPassObj¶ÔÏó£¬È»ºó°ÑÕâ¸öPassObjµÄÒýÓø³¸ø±äÁ¿objA£¬µÚ¶þ¾äÊÇ°ÑPassObj¶ÔÏóµÄÒýÓÃÓÖ¸³¸øÁ˱äÁ¿objB¡£´ËʱobjAºÍobjBÊÇÁ½¸öÍêÈ«Ò»ÖµıäÁ¿£¬ÒÔºóÈκζÔobjAµÄ¸Ä±ä¶¼µÈͬÓÚ¶ÔobjBµÄ¸Ä±ä¡£Hashtable²¢²»ÄÜÕæÕý´æ´¢ÄܶÔÏ󣬶øÖ»ÄÜ´æ´¢¶ÔÏóµÄÒýÓá£ËùÒÔ£¬Hashtable²»ÄÜÕæµÄ´æ´¢¶ÔÏó£¬Ö»ÄÜÊǶÔÏóµÄÒýÓá£import java.util.*;
public class HashtableAdd{
    public static void main(String[] args){
        Hashtable ht = new Hashtable();
        StringBuffer sb = new StringBuffer();
        //append Ö»ÔÚStringBufferÖÐÓÐ.
        sb.append("abc,");
        ht.put("1",sb);    
        sb.append("def,");
        ht.put("2",sb);
        sb


Ïà¹ØÎĵµ£º

JavaÖнӿڵÄ×÷ÓÃ

½Ó¿ÚµÄ×÷Óà
½Ó¿ÚµÄ×÷Óüòµ¥Ò»µã¾ÍÊÇ:½Ó¿ÚÊÇÓÃÀ´±ê¼ÇÀàµÄ£¬²»Í¬µÄÀàÊôÓÚ²»Í¬µÄ½Ó¿Ú£¨Í¨¹ýÏòÉÏתÐÍ£©£¬¹ÜÀí½Ó¿Ú±È¹ÜÀí¸÷ÖÖ¸÷ÑùµÄÀà·½±ã¶àÁË£¬½Ó¿ÚÌåÏÖÁ˳éÏóµÄ¹Ûµã,ʲôÊdzéÏ󣿳éÏó¾ÍÊÇ"³éÈ¥ÏñµÄ²¿·Ö"¡£ 
ʹÓýӿڽâ¾öÎÊÌâ 
ÎÊÌâ:ÏÖÔÚÎÒÃÇҪд¸öÁ¬½ÓÊý¾Ý¿âµÄÀà¸øÓû§Ê¹Óã¬ÓÐÁ½¸öº¯Êý:Ò»¸ö·µ»ØConnection ......

JavaÖг£ÓÃÉè¼Æģʽ×ܽá

ÔÚJavaÖÐÓÐ23ÖÐÉè¼Æģʽ£¬ÏÂÃæÖ»¶Ô²¿·Ö³£ÓõÄÉè¼Æģʽ½éÉÜһϣº
1.µ¥Àýģʽ£¨ÓеÄÊéÉÏ˵½Ðµ¥Ì¬Ä£Ê½Æäʵ¶¼Ò»Ñù£©
¸ÃģʽÖ÷ҪĿµÄÊÇʹÄÚ´æÖб£³Ö1¸ö¶ÔÏ󡣿´ÏÂÃæµÄÀý×Ó£º
package org.sp.singleton;
//·½·¨Ò»
public class Singleton {
//½«×ÔÉíµÄʵÀý¶ÔÏóÉèÖÃΪһ¸öÊôÐÔ,²¢¼ÓÉÏStaticºÍfinalÐÞÊηû
private static f ......

dz̸Java¶àÏ̵߳Äͬ²½ÎÊÌâ

¶àÏ̵߳Äͬ²½ÒÀ¿¿µÄÊǶÔÏóËø»úÖÆ£¬synchronized¹Ø¼ü×ֵı³ºó¾ÍÊÇÀûÓÃÁË·âËøÀ´ÊµÏÖ¶Ô¹²Ïí×ÊÔ´µÄ»¥³â·ÃÎÊ¡£
ÏÂÃæÒÔÒ»¸ö¼òµ¥µÄʵÀýÀ´½øÐжԱȷÖÎö¡£ÊµÀýÒªÍê³ÉµÄ¹¤×÷·Ç³£¼òµ¥£¬¾ÍÊÇ´´½¨10¸öỊ̈߳¬Ã¿¸öÏ̶߳¼´òÓ¡´Ó0µ½99Õâ100¸öÊý×Ö£¬ÎÒÃÇÏ£ÍûÏß³ÌÖ®¼ä²»»á³öÏÖ½»²æÂÒÐò´òÓ¡£¬¶øÊÇ˳ÐòµØ´òÓ¡¡£
ÏÈÀ´¿´µÚÒ»¶Î´úÂ룬ÕâÀïÎÒÃÇÔÚru ......

java 23ÖÖÉè¼ÆģʽÖг£ÓõľÅÖÖ

1 Factory Pattern£¨¹¤³§Ä£Ê½£©
¡¡¡¡ÉÏ°ñÀíÓÉ£º½«³ÌÐòÖд´½¨¶ÔÏóµÄ²Ù×÷£¬µ¥¶À³öÀ´´¦Àí£¬´ó´óÌá¸ßÁËϵͳÀ©Õ¹µÄÈáÐÔ£¬½Ó¿ÚµÄ³éÏ󻯴¦Àí¸øÏ໥ÒÀÀµµÄ¶ÔÏó´´½¨ÌṩÁË×îºÃµÄ³éÏóģʽ¡£
¡¡¡¡2 Facade Pattern
¡¡¡¡ÉÏ°ñÀíÓÉ£º½«±íÏÖ²ãºÍÂß¼­²ã¸ôÀ룬·â×°µ×²ãµÄ¸´ÔÓ´¦Àí£¬ÎªÓû§Ìṩ¼òµ¥µÄ½Ó¿Ú£¬ÕâÑùµÄÀý×ÓËæ´¦¿É¼û¡£ÃÅÃæģʽºÜ¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ