×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Java Method Overloading Java Method Overriding
Java Inheritance - Java
3539    Arnab De    18/07/2017

What is Inheritance?

In Object oriented programming, we can create a class by inheriting the structure of another class. This is known as inheritance. Here newly created class is known as child class and the class from which it creates is known as Parent class.

Note: Child classes are also known as Base class or super class.

Note: Child classes are also known as derived class or sub class.

Note: In java we use extends as a keyword to implement the concept of inheritance.

softetechnologies

How many types of Inheritance are possible?

There are 5 types of inheritance are possible

  1. Simple or single Inheritance: Here one derived class inherits from only one base class.

    class Human
    {
    ....
    ....
    ....
    }
    class Indian extends Human
    {
    .... 
    .... 
    ....
    }
    Single Inheritance
    Single Inheritance
  2. Multilevel Inheritance: Here one derived class inherits from a class, after than another class also inherits from the said derived class. The Super class for one is sub class for the other.

    class Human
    {
    ....
    ....
    ....
    }
    class Indian extends Human
    {
    .... 
    .... 
    ....
    }
    class Bengali extends Indian
    {
    .... 
    .... 
    ....
    }
    Multilevel Inheritance
    Multilevel Inheritance
  3. Hierarchical Inheritance: Here more than one class derived from a single base class.

    class Human
    {
    ....
    ....
    ....
    }
    class Indian extends Human
    {
    .... 
    .... 
    ....
    }
    class Bangladeshi extends Human

    .... 
    .... 
    ....
    }
    class Pakistani extends Human

    .... 
    .... 
    ....
    }
    Hierarchical Inheritance
    Hierarchical Inheritance
  4. Multiple Inheritance: Here one class derived from more than one base class
    Multiple Inheritance
    Multiple Inheritance
  5. Hybrid Inheritance: It is a combination of Hierarchical and Multilevel Inheritance.
    Hybrid Inheritance
    Hybrid Inheritance
softetechnologies

Note: Multiple and Hybride Inheritances are not supported in java by class. We can implement it by the interface.

Note: We can Alter Or Add any propery of Super class in sub class but can not delete any property.

Java Method Overloading Java Method Overriding
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Albert Einstein
If you can't explain it simply, you don't understand it well enough.
Albert Einstein
24381
52.73
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     42027
01/01/2018     36003
28/06/2017     34089
25/06/2018     33447
02/08/2017     32401
01/08/2017     26862
06/07/2017     26791
15/05/2017     26417
14/07/2017     21855
21/04/2018     20717
softetechnologies