Step1. Create a program and define the constructor in both the super and sub class. Constructor is always executed form the super class to the Sub class in OO concept. So if the object of the Sub class is created, then constructor of the sub class is called first and within this sub class constructor method using the SUPER keyword the super class constructor should be called other wise we ll receive a compile time error. So mostly SUPER keyword is used in Inheritance concept where we have same method in both the SUPER & SUB class. Execute the program.
Step2. The O/P is as follows:
Step3. Let’s define a method in the super class and redefine it in the subclass as well. Call the Subclass method. Here calling the super class redefined method is optional but in case of constructor it is mandatory to call the super class constructor in the subclass constructor.
Step4. The O/P is as follows: