Why is constructor of super class invoked when we declare the object of sub class? (Java)

Because it will ensure that when a constructor is invoked, it can rely on all the fields in its superclass being initialised.

see 3.4.4 in here

Leave a Comment