Hey,buddy:What's up?

          Happy&Optimistic&Effective

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            14 Posts :: 1 Stories :: 0 Comments :: 0 Trackbacks

          ps:from Thinking in Java chapter 4

          Consider a class called Dog:

          1. The first time an object of type Dog is created (the constructor is actually a static method), or the first time a static method or static field of class Dog is accessed, the Java interpreter must locate Dog.class, which it does by searching through the classpath. 
          2. As Dog.class is loaded (creating a Class object, which you’ll learn about later), all of its static initializers are run. Thus, static initialization takes place only once, as the Class object is loaded for the first time. 
          3. When you create a new Dog( ), the construction process for a Dog object first allocates enough storage for a Dog object on the heap. 
          4. This storage is wiped to zero, automatically setting all the primitives in that Dog object to their default values (zero for numbers and the equivalent for boolean and char) and the references to null
          5. Any initializations that occur at the point of field definition are executed. 
          6. Constructors are executed. As you shall see in Chapter 6, this might actually involve a fair amount of activity, especially when inheritance is involved.
          posted on 2005-07-13 09:22 Kun Tao's Blog 閱讀(220) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 霸州市| 板桥市| 西畴县| 庐江县| 高邑县| 上林县| 津市市| 盐亭县| 溧水县| 孝昌县| 江安县| 肇东市| 苍山县| 梁河县| 新营市| 阳曲县| 桓台县| 都昌县| 柳林县| 磴口县| 阿荣旗| 华亭县| 且末县| 日土县| 松滋市| 沅陵县| 霍山县| 清苑县| 米脂县| 马鞍山市| 喀喇沁旗| 广河县| 长沙县| 叶城县| 龙游县| 清镇市| 新和县| 富锦市| 酒泉市| 河间市| 密山市|