deep

a Cross Development Platform for Java

User Tools

Site Tools


dev:crosscompiler:class_initialization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:crosscompiler:class_initialization [2015/04/06 13:37] – [Initialisierung von Objekten] ursgrafdev:crosscompiler:class_initialization [2021/05/10 19:52] (current) ursgraf
Line 14: Line 14:
 </code> </code>
 ==== When will a class be initialized? ==== ==== When will a class be initialized? ====
-On the host we have a situation like this. The class constructor of a top-level class will be called first. Then follows the method //main//. The class constructor of an imported class will be called when:+On the host we have a situation as follows. The class constructor of a top-level class will be called first. Then follows the method //main//. The class constructor of an imported class will be called when:
   * accessing a static field of an imported class   * accessing a static field of an imported class
   * calling a static method of an imported class   * calling a static method of an imported class
Line 50: Line 50:
   }   }
 </code> </code>
-In the Bytecode these constructors carry the name /init// and vary in the parameter list. Block 1 and block 2 in the above code block will be combined in //init//.+In the Bytecode these constructors carry the name //init// and vary in the parameter list. Block 1 and block 2 in the above code block will be combined in //init//.
 When creating an object a call to //new// allocates a block on the heap. Next, the constructor of the super class is called (which itself calls its super class constructor). These calls can be found in the Bytecode. When creating an object a call to //new// allocates a block on the heap. Next, the constructor of the super class is called (which itself calls its super class constructor). These calls can be found in the Bytecode.
 Classes might also have instance initializers, such as:  Classes might also have instance initializers, such as: 
dev/crosscompiler/class_initialization.1428320237.txt.gz · Last modified: 2016/02/25 13:33 (external edit)