Class loading process and active and passive use of classes

The loading process of the class is as follows:

1. Loading phase

2. Connection phase

2.1 Verification

2.2 Preparation

2.3 Analysis

3. Initialization

                   

Active and passive use of the class (initialization)

1. new object

2. Access the static method of the class

3. Access the static properties of the class

4. Access the class through reflection

5. Access to the static properties of the subclass will result in the initialization of the parent and child classes           

6. The class where the main function is located directly leads to this type of initialization       

Guess you like

Origin blog.csdn.net/qq_39839828/article/details/111571702