Why base class constructors are executed first? and then derived?
I don't know, java document says so, that's why.
It is a standard.
May be we will be using some of the base class variables in derived class constructor.
Since you are inheriting base class properties into derived class, there may be some situations where your derived class constructor requires some of the base class variables to initialize its variables. So first it has to initialize base class variables, and then derived class variables. That's why Java calls first base class constructor, and then derived class constructor.
And also it doesn't make any sens to initialize child class with out initializing parent class.
Back To Top