The Java Language Specification, Java SE 7 Edition (Java Series) by Gosling James & Joy Bill & Steele Guy L. Jr. & Bracha Gilad & Buckley Alex

The Java Language Specification, Java SE 7 Edition (Java Series) by Gosling James & Joy Bill & Steele Guy L. Jr. & Bracha Gilad & Buckley Alex

Author:Gosling, James & Joy, Bill & Steele, Guy L., Jr. & Bracha, Gilad & Buckley, Alex [Gosling, James]
Language: eng
Format: epub
Publisher: Pearson Education
Published: 2013-02-13T21:00:00+00:00


12.1.3. Initialize Test: Execute Initializers

In our continuing example, the Java Virtual Machine is still trying to execute the method main of class Test. This is permitted only if the class has been initialized (§12.4.1).

Initialization consists of execution of any class variable initializers and static initializers of the class Test, in textual order. But before Test can be initialized, its direct superclass must be initialized, as well as the direct superclass of its direct superclass, and so on, recursively. In the simplest case, Test has Object as its implicit direct superclass; if class Object has not yet been initialized, then it must be initialized before Test is initialized. Class Object has no superclass, so the recursion terminates here.

If class Test has another class Super as its superclass, then Super must be initialized before Test. This requires loading, verifying, and preparing Super if this has not already been done and, depending on the implementation, may also involve resolving the symbolic references from Super and so on, recursively.

Initialization may thus cause loading, linking, and initialization errors, including such errors involving other types.

The initialization process is described further in §12.4.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.