What happened behind new deerivedclass () in java
(Original - Shao Zhengjun, 2005-4-5)
Class DerivedClass Extends Baseclass {...}
New derivedclass ();
1 Loading CLASS
1.1 Load BaseClass where [Load Class] is generated here.
1.2 Load DerivedClass
1.2.1 is a class scope variable, that is, the static variable, allocated storage space, and assigns a default value.
1.2.2 Calling
2 Allocate storage space for example scope variables and assign default.
3 call constructor *** Note: Java specifies: The first barrier of constructor must be a call to the Super constructor. If this is not the case, it will be automatically sneaked by the compiler.
3.1 Call the SUPER constructor where [Call Construction Function] is generated here.
3.2 Calling
3.3 Performing the remainder in the constructor.