super keyword in java

Posted in Java Inheritance By Raj On December 2, 2017

 

If you want to access parent class methods and fields in the child class then you need to use super keyword, the super is a reference object for parent class, we use super keyword in java inheritance

In the below Java inheritance example code, I am using super keyword to read parent methods and fields, here the motorcycle class is a parent class which has two public methods and one public field

To access parent class public methods and fields in the child class I am using below code