Embed presentation
Download to read offline




![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-151025050827-lva1-app6891/75/Super-keyword-in-java-5-2048.jpg)


The super keyword in Java is a reference variable used to refer to parent class objects and helps resolve ambiguity when both base and derived classes have the same data. It is utilized at three levels: variable, method, and constructor. An example illustrates its use, demonstrating how to access a base class variable 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-151025050827-lva1-app6891/75/Super-keyword-in-java-5-2048.jpg)
