Super Keyword

Learn about the uses of the super keyword in Java.

What is the super keyword?

this keyword in Java is used to refer to the instance of the current class.

In a similar fashion, the super keyword in Java is used to refer to the SuperClass members from inside the immediate Subclass. The use of super comes into play when we implement inheritance.

Use cases of the super keyword

The super keyword is used in three major contexts:

Accessing parent class fields

Consider the fields named as fuelCap defined inside a ...