Inheritance what?&why?

Inheritance is an important feature where a class can be extended and reused by another class.

A inherited class can be called as subclass or childclass.

The class which is inherited is called as Base class or Parent class or Super class.

The main advantage of inheritance is re-usability.

A class can be extended in java using keyword  “extends


Here any object created for Card class have only 2 properties, however the Creditcard class object have 2 extra properies apart from 2 property extended from Card class.

Leave a Reply

Your email address will not be published. Required fields are marked *