1. Perform static member assignments and static initialization blocks if the parent class has static member assignments or static initialization blocks
2. Perform static member assignments and static initialization blocks if the class has static member assignments or static initialization blocks
3. Assign the member of the class to the initial value (the values of the members of the original type are the specified values, for example, the int type is 0,float type is 0.0f,boolean type is false; The initial value of the object type is null)
4. If there is a this () call in the construction method (which can be another call of this () with parameters), execute it and proceed to the 7th step after execution, and proceed if there is no this call. (There is a possibility of recursive invocation of other constructs)
5. Perform an explicit super () call (which can be another super () call with parameters) or an implicit super () call (the default constructor method), which goes into the construction of a parent class and pushes up to the object's construction.
6. Execute the member assignment and initialization block in the class declaration.
7. Execute other statements in the constructor method.
The final simplified sequence version is:
1. Static member assignments and static blocks of the parent class
2. Static members and static blocks of subclasses
3. How to construct a parent class
4. Member assignments and initialization blocks of the parent class
5. Other statements in the constructor method of the parent class
6. Member assignments and initialization blocks for subclasses
7. Other statements in the construction method of a subclass
Java Class Execution order