Special Offer take any 4 courses for INR 21999.00*

Courses
0

What is the significance of the super keyword in Java?

December 26, 2024

The super keyword in Java is used to reference members of a superclass from within a subclass. It is significant in the following ways:
Accessing Superclass Members
It allows access to the fields, methods, or constructors of a superclass when they are hidden by subclass members of the same name.
Calling Superclass Methods
super is used to call methods of the superclass that have been overridden in the subclass.
class Parent {
void show() { System.out.println(“Parent Method”); }
}
class Child extends Parent {
void show() {
super.show(); // Calls Parent’s method
System.out.println(“Child Method”);
}
}

Leave a Comment

Drop a Query

Whether to upskill or for any other query, please drop us a line and we'll be happy to get back to you.

Drop a Query NEW

Request A Call Back

Please leave us your contact details and our team will call you back.

Request A Call Back

By tapping Submit, you agree to Cambridge infotech Privacy Policy and Terms & Conditions

Enquiry Now

Enquiry popup