Inheritance in Java
Inheritance Inheritance is one of the key feature of Object Oriented Programming in java. It is a mechanism in which one object acquires all the properties and behaviors of parent object. Inheritance represents the IS-A relationship , also known as parent-child relationship. The derived class inherits the states and behaviors from the base class. The derived class is also known as sub class and base class is also known as super-class. Inheritance is used in Java to achieve Method Overloading (To achieve runtime polymorphism) and Code Reusability. Syntax of Inheritance: class Subclass-name extends Superclass-name { //methods and fields } Extends keyword represents that you are making a new class which will extend the features of super class. 1. Superclass-name is super class of Subclass-name. 2. Subclass-name is sub class of Superclass-name. 3. Subclass-name IS-A Superclass-name. Disadvantage of Inheritance is