Super keyword in Java
It’s a reference variable that is used to be referring immediate parent class objects. This concepts came from inheritance.
Super keyword used in the below forms
- Super with Variables
- Super with Methods
- Super with Constructors
Super with Variables:
If parent and child class has same variable then this will be achieve using super keyword.
Super with Methods:
If parent and child class has same methods then this will be achieve using super keyword. suppose the below same method in both classes then it will be call as.
show(); // child class super.show(); // Parent Class
Super with Constructors:
Using super keyword we can call parent class constructor also and it can be default and parameterized.