The order of initialization is first static (if they have not been initialized by the previous object, that is, when the new object is initialized), the variable initialization order has variables in the class definition order;
object creation process, take the dog class as an example:
1. The Java compiler must find Dog.class when the first stati of the dog is created, or when the Stajitic method/static field of the dog class is accessed;
2. When Dog.class is found (it creates a class object), all of its static initialization modules will run. Therefore, static initialization occurs only once-----when the class object is first loaded
3. When creating a new dog (), the build process of the dog object allocates enough memory space for a dog object in the memory heap (heap) first;
4. This space is 0, and all the basic types in dog are set to their default values;
5. All initialization occurs when the field definition is performed;
6. Execute the constructor
The creation process of Java objects