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

javaÖй¹Ô캯ÊýµÄµ÷ÓÃ˳Ðò

µ±Ò»¸ö¸´ÔӵĶÔÏó±»¹¹Ôìʱ,ËüµÄ¹¹Ô캯Êý°´ÏÂÃæµÄ˳Ðò±»µ÷ÓÃ(that the order of constructor calls for a complex object is as follows)
    1.Æä»ùÀà(base-class)µÄ¹¹Ô캯Êý±»µ÷ÓÃ,Õâ¸ö²½ÖèÒԵݹéµÄ·½Ê½Öظ´,ËùÒÔ×îµ×²ã(the root of hierarchy)µÄ¹¹Ô캯ÊýÊ×Ïȱ»Ö´ÐÐ,È»ºóÊÇËüÉÏÒ»²ãÅÉÉúÀà(the next-derived class)...Ö±µ½×²ãµÄÅÉÉúÀà(the most-derived class).
The base-class constructor is called. This step is repeated recursively such that the root of the hierarchy is constructed first, followed by the next-derived class, etc., until the most-derived class is reached.)
    2.Èç¹ûÓаüº¬¹Øϵ(composition),ÄÇôËüµÄ³ÉÔ±¶ÔÏó°´ÕÕÉùÃ÷µÄ˳Ðò±»¹¹Ôì.
Member initializers are called in the order of declaration.
    3.ÅÉÉúÀ๹Ô캯ÊýµÄÄÚÈÝ(body)±»Ö´ÐÐ.
The body of the derived-class constructor is called.
    Ò»¸öʵÀý:
class Cake{
   Cake(){System.out.println("Cake()");}
}
class Meal {
  Meal() { System.out.println("Meal()"); }
}
class Bread {
  Bread() { System.out.println("Bread()"); }
}
class Cheese {
  Cheese() { System.out.println("Cheese()"); }
}
class Lettuce {
  Lettuce() { System.out.println("Lettuce()"); }
}
class Lunch extends Meal {
  Lunch() { System.out.println("Lunch()"); }
}
class PortableLunch extends Lunch {
   //if make derived-class object as the menber of the base-class will lead a infinite
   //loop and program will stop because of the memory consumed
   
   //private Sandwich s=new Sandwich(); 
  private Cake a=new Cake();
  PortableLunch() {&n


Ïà¹ØÎĵµ£º

JavaÀàµÄ³õʼ»¯Ë³Ðò

ÎÒÃÇ´ó¼Ò¶¼ÖªµÀ£¬¶ÔÓÚ¾²Ì¬±äÁ¿¡¢¾²Ì¬³õʼ»¯¿é¡¢±äÁ¿¡¢³õʼ»¯¿é¡¢¹¹ÔìÆ÷£¬ËüÃǵijõʼ»¯Ë³ÐòÒÀ´ÎÊÇ£¨¾²Ì¬±äÁ¿¡¢¾²Ì¬³õʼ»¯¿é£©>£¨±äÁ¿¡¢³õʼ»¯¿é£©>¹¹ÔìÆ÷¡£ÎÒÃÇÒ²¿ÉÒÔͨ¹ýÏÂÃæµÄ²âÊÔ´úÂëÀ´ÑéÖ¤ÕâÒ»µã£º
 
Java´úÂë
public class InitialOrderTest {   
  
   ......

java ·þÎñÆ÷µÄ¶Ô±È

TomcatÊÇÒ»¸ö¿ª·ÅÔ´´úÂë¡¢ÔËÐÐservletºÍJSP WebÓ¦ÓÃÈí¼þµÄ»ùÓÚJavaµÄWebÓ¦ÓÃÈí¼þÈÝÆ÷¡£TomcatÓÉApache-Jakarta×ÓÏîÄ¿Ö§³Ö²¢ÓÉÀ´×Ô¿ª·ÅÐÔÔ´´úÂëJavaÉçÇøµÄÖ¾Ô¸Õß½øÐÐά»¤¡£Tomcat ServerÊǸù¾ÝservletºÍJSP¹æ·¶½øÐÐÖ´Ðеģ¬Òò´ËÎÒÃǾͿÉÒÔ˵Tomcat ServerҲʵÐÐÁËApache-Jakarta¹æ·¶ÇұȾø´ó¶àÊýÉÌÒµÓ¦ÓÃÈí¼þ·þÎñÆ÷ÒªºÃ¡£×öÎ ......

¡¾·Ü¶·µÚÎåÌì¡¿²ËÄñѧJavaÖ®ÎÒÒ²ÓñȽÏÆ÷

ѧÁ˼¯ºÏÀ࣬ÏëÓÃJavaµÄ¼¯ºÏÀà±àÒ»¸öͨѶ¼£¬¿ÉÊÇ·¢ÏÖÌâÄ¿Òª¶ÔͨѶ¼ÖеÄÐÕÃûºÍ±àºÅ½øÐÐÅÅÐò¡£
²ËÄñ¸Õ¸ÕѧJava£¬±¾À´»¹Õæ²»ÖªµÀÓбȽÏÆ÷£¬ºÙºÙ£¬ÒÔΪJavaÊÇÈç´ËÇ¿´ó£¬¿ÉÒÔÖ±½Óµ÷ÓÃSort()·½·¨¾Í¿ÉÒÔ¶Ô¼¯ºÏÀàÖеĶÔÏó½øÐÐÅÅÐò£¬ºÙºÙ£¬ÓÚÊDZãÊÔÁËһϣ¬Ì«²»ºÃʹÁËѽ£¬ºÙºÙ£¬ÓÚÊÇÎÒ¿´ÁË¿´Ê飬µ½ÍøÉϲéÁ˲飬ԭÀ´ÒªÊµÏֱȽÏÆ÷µÄ ......

±à³Ì, ÔĶÁ³ÌÐò, Java,¿ªÔ´

¡¡¡¡×î½üÒ»Á½¸öÔÂÒÔÀ´Ò»Ö±ÔÚ¿´java ´úÂ룬 ¿´ÁËһЩ¿ªÔ´µÄʵÏÖ£¬ Ò²¿´ÁËһЩ²úÆ·ÖеĴúÂ룬´ÓÕâЩ´úÂëÖУ¬Ñ§Ï°ÁËһЩ¿ªÔ´¿ò¼ÜµÄÓ¦Óã¨ÈçActiveMQ£¬cxf£©£¬Ò²Ñ§Ï°ÁËÕâЩ¿ò¼ÜµÄʵÏÖ£¬Í¬Ê±Ò²×¢ÒâÈ¥Àí½âÿ¸öÀà ÒÔ¼°½Ó¿ÚµÄÉè¼Æ£¬ÒÔ¼°Éè¼ÆģʽµÄÓ¦Ó㬠¹Ø×¢ÁËһϣ¬Ã¿¸öÀ࣬½Ó¿ÚµÄ¹æÄ££¬»ù±¾ÉÏÓÐһЩҲ»á·Ç³£´ó£¬Óм¸Ç§ÐУ¬ÓÐһЩ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ