About the initialization of Java feel that they do not understand, can only understand here, I hope Daniel can guide
Initialization follows
1. When the reference is established
Initializes a static variable for the parent class, and a static code snippet
Initializes the static variables of the subclass, as well as the static code snippet
2 When you create an object
Initializes a static variable for the parent class, and a static code snippet
Initializes the static variables of the subclass, as well as the static code snippet
The normal (global) variables of the parent class are then initialized, along with the normal code snippets and constructors
Initializes the generic (global) variables of the subclass, as well as normal code snippets and constructors
There is only one copy of the static here, and each time the reference is not repeated and does not exist in the heap,
A (global) normal variable does not have an object that is not initialized or does not exist
Static is initialized only once, which is initialized at first use, and constructors and non-static variables are initialized each time they are created.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Questions about Java Initialization