Whenever any constructor is called in any derived class the task gets accomplished only by eventually calling the base class constructor implicitly or explicitly (correct me if I am wrong here).
Since we intended to create an instance of the derived class, but since the base class constructor is called in the end.
So, how is an instance of the derived class constructed despite the constructor of base class being called upon?
Don't think of the constructor as creating the instance. Think of it as initializing the instance, with respect to that particular class.
So the initialization process looks something like:
java.lang.Object
your.package.Superclass
your.package.Subclass
(Even though you start with a call to new Subclass(...)
, the superclass constructor body is executed first.)
The details of object initialization are given in JLS section 12.5.
See more on this question at Stackoverflow