The initialization process of Java object [original]

xiaoxiao2021-03-06  70

1. Loading the class file: first load the .class file of the class, then load the .class file of each base class in turn until

The uppermost .class file.

2. After the file is loaded, the Static member of each level of class is initialized from the top base class.

3. Allocate the storage space for the object and initialize the space to the zero value of binary.

4. Initialize all the basic types of basic types of this object to the default value (for numerical and CHAR type, the default value is 0; for Boolean, the default is false.), In the member variable Object reference is set to NULL.

5. Start from the top level, perform all initialization actions that appear at the data definition.

6. Call the constructor of each class from the top level class.

转载请注明原文地址:https://www.9cbs.com/read-120679.html

New Post(0)