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/superkeywordinjavappt-240710141916-ed58e6bf/85/superkeyword-package-final-keywordinjava-ppt-pptx-5-320.jpg)
The super keyword in Java is used to reference a parent class object and is applicable at the variable, method, and constructor levels. It helps resolve ambiguity when base class and derived class data are the same. An example illustrates how it allows access to the parent class's variable in 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/superkeywordinjavappt-240710141916-ed58e6bf/85/superkeyword-package-final-keywordinjava-ppt-pptx-5-320.jpg)