Single class
The order of initialization is as follows: (1) static data members, (2) static data blocks, (3) instance data members, (4) instance data blocks, (5) constructors.
The first round, scanning static things to initialize, contains (1), (2).
The second round, scanning non-static things to Initialize, contains (3).
In the third round, the constructor is initialized, containing (4).
Have inherited
(1) The parent class static data member, (2) The parent class static data block, (3) subclass static data member, (4) subclass static data block, (5) Parent class instance data member, (6) Parent class instance data block, (7) Parent class constructor, (8) Child class instance data member, (9) Subclass instance data block, (10) subclass constructor.
In the first round, the scanning of static things is initialized, whether it is a subclass or a parent class, containing (1), (2), (3), (4).
In the second round, scans the parent class for non-static initialization, which is limited to the parent class, which contains (5), (6).
Third round, initializes the parent class constructor, which contains (7).
The fourth round, the scan subclass non-static things to initialize, attention is limited to subclasses, including (8), (9).
In the fifth round, the sub-class constructor is initialized, containing (10).
Java Initialization Order