Class execution sequence, final usage, and execution sequence final usage
---------- Java class initialization sequence -----------
1. Static variables
2. Static code block
3. main Method
4. class attributes
5. Code Block
6. Constructor
------ If there is a parent class, it is :---------
1. parent class-static variables
2. parent class-static code block
3. Subclass-static variables
4. Subclass-static code block
5. parent class-attributes
6. parent class-code block
7. parent class -- Constructor
8. Subclass-attributes
9. Subclass-code block
10. Subclass-Constructor
Note:
1. If the Test class has a static code block or static attribute, the main () method is executed only when all the static variables and static code blocks of the Test class have been loaded.
2. The static code segment is executed only when the class is loaded for the first time.
* ------------- Final: Finally -------------------
* 1. The variable modified with final is a constant.
* 2. The value of the reference type (such as object) modified with final can be changed, but it cannot be new.
* 3. The final modification method cannot be rewritten.
* 4. Classes modified with final cannot be inherited.
*/