The super keyword in java is a reference variable that is used to refer parent class objects.
* Use of super with variables. When a derived class and base class has same data members, to resolve ambiguity we use super keyword.
* Use of super with methods. Whenever a parent and child class have same named methods, to resolve ambiguity we use super keyword.
* Use of super with constructors. Super keyword can also be used to access the parent class constructor.
```
class Person {
int age = 10;
Person() {
System.out.println("Person()");
}
void show() {
System.out.println("Person::show()");
System.out.println(age);
}
}
class Student extends Person {
int age = 20;
Student() {
super();
System.out.println("Student()");
}
void show() {
super.show();
System.out.println(super.age);
System.out.println("Student::show()");
System.out.println(age);
}
}
class Main {
public static void main(String[] args) {
Student s = new Student();
s.show();
}
}
```