The execution order of class

Java instantiation order:

1. Static variable parent class and a static block assignment

2. own static variables and static block assignment

3.main method

4. parent class member variables and a block assignment, assignment parent class constructor

The member variables and block assignments themselves, their assignment constructor

6. static methods, instance method invocation will be performed

Reference: https://www.cnblogs.com/timetellu/p/11619158.html

Guess you like

Origin www.cnblogs.com/xc-xinxue/p/12561297.html