This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:crosscompiler:class_initialization [2015/04/06 13:37] – [Initialisierung von Objekten] ursgraf | dev:crosscompiler:class_initialization [2021/05/10 19:52] (current) – ursgraf | ||
---|---|---|---|
Line 14: | Line 14: | ||
</ | </ | ||
==== When will a class be initialized? | ==== When will a class be initialized? | ||
- | On the host we have a situation | + | On the host we have a situation |
* 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: | ||
} | } | ||
</ | </ | ||
- | 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, | Classes might also have instance initializers, |