×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Java Method Overloading Java Method Overriding
Java Inheritance - Java
4100    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.
Sri Sri Ramakrishna Paramahamsa
All religions are true. God can be reached by different religions. Many rivers flow by many ways but they fall into the sea. They all are one.
Sri Sri Ramakrishna Paramahamsa
6053
62.02
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     45777
25/06/2018     37973
01/01/2018     37712
28/06/2017     35686
02/08/2017     34344
01/08/2017     28665
06/07/2017     28417
15/05/2017     27966
14/07/2017     23775
11/09/2018     22612
softetechnologies