super can be used to refer immediate parent class instance variable.
Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)
1771Program:
class Parent{ int age=70; } class Child extends Parent{ int age=40; void printAge(){ System.out.println(age);//prints age of Child class System.out.println(super.age);//prints age of Parent class } } class SuperKeyword{ public static void main(String args[]){ Child obj=new Child(); obj.printAge(); } }
Output:
40 70 Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.