Inheritance is one of the important concepts in Object Oriented Programing System (OOPS), as it supports the concept of hierarchical classification. Inheritance is the process that one object acquires the property of another object. It can also be described by top-down approach. Without the use of this hierarchy, each object need to explain its characteristics explicitly. And if we use inheritance, an object needs only those qualities that makes it unique within its class. From its parent class we can get the general attributes. Thus, the inheritance mechanism of an object makes it possible for one object to be a specific instance of a more general case.

In Java, for two reason inheritance is used, one for class inheritance and another for interface inheritance. Class inheritance creates a class which is an extension of another class, that is sub class inherits the data and method of super class. The Interface inheritance creates a class to implement the methods defined by an interface. The keyword which is used for class inheritance is ‘extends’ and for interface inheritance, ‘implements’ is used.

Order of Inheritance:

Before executing the body of derived class, the base class constructor calls implicitly. So in inheritance objects are constructed under top-down approach. Since all object inherits from Object class which calls implicitly. In java, most objects inherits from java.lang.Exception class.

In inheritance the base class is represented as super class and child as sub class. By using inheritance we can reach the concept of re usability. The sub class can use the variables and methods of base class and they can add their own methods and variables. It represents problems in the real world. The access modifier in member function are public, protected and private. The subclass can only inherit pubic and protected, private members are not inherited in subclass.

In java there are two forms of inheritance. One is standard form and another special form. The standard form is by extension, by a class which declare another class or by interface which extends another. Here the sub-class or interface inherits all the fields and methods from base class. And the special form is by implementing an interface. The java support Single and Multi-Level inheritance. Single inheritance is the feature of one class inherited by another class. And Multi-Level is the classes extending one after another. For example Class X extends Class Y, Class Y extends Class Z and so on. But java allows partial multiple inheritance using interfaces.