Inheritance
Inheritance
In inheritance, a subclass inherits the properties and methods of its superclass. However,
constructors are not inherited by the subclass. The subclass must call the constructor of
the superclass explicitly or implicitly. The superclass constructor is always invoked when
a subclass object is created.
By default, the subclass constructor calls the superclass constructor implicitly. Java automatically
inserts a call to the no-argument constructor of the superclass.
Super keyword
The super keyword in Java is a reference variable which is used to refer immediate parent class object.
Whenever you create the instance of subclass, an instance of parent class is created implicitly which is referred by
super reference variable.