Contact Us || Privacy Policy || About Us |
|
Super Keyword in Java | Example→ super keyword is a reference variable that is used to refer immediate parent class objects. Usage of Super Keyword
1) Super keyword use in Variable→ super keyword allow to access the data member, field of parent class. same fields or data member of parent class and child class. Example: Output :- ![]() Note :-To access the parent property, so use super keyword. 2) Super keyword use in Method→ super keyword can also be used to immediate parent class method. same named methods of parent and child class . Example: Output :- ![]() 3) Super keyword use in Constructor→ super keyword can also be used to invoke the parent class constructor Example: Output :- ![]() Real Example :-Example: Output :- ![]() |