Embed presentation
Downloaded 101 times




![Example of Super Keyword
class Employee {
float salary=10000;
}
class HR extends Employee {
float salary=20000;
void display() {
System.out.println("Salary: "+super.salary);//print base class salary
}
}
class Supervarible {
public static void main(String[] args) {
HR obj=new HR();
obj.display();
}
}](https://image.slidesharecdn.com/superkeywordinjava-151002142514-lva1-app6892/75/Super-keyword-in-java-5-2048.jpg)


The super keyword in Java is a reference variable used to refer to a parent class's object. It helps resolve ambiguity when base and derived classes have the same data by differentiating between them at variable, method, and constructor levels. An example is provided where the super keyword is used to access a base class's salary property from a derived class.




![Example of Super Keyword
class Employee {
float salary=10000;
}
class HR extends Employee {
float salary=20000;
void display() {
System.out.println("Salary: "+super.salary);//print base class salary
}
}
class Supervarible {
public static void main(String[] args) {
HR obj=new HR();
obj.display();
}
}](https://image.slidesharecdn.com/superkeywordinjava-151002142514-lva1-app6892/75/Super-keyword-in-java-5-2048.jpg)
