×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Java Method Overloading Java Method Overriding
Java Inheritance - Java
4710    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
God is in all men, but all men are not in God; that is why we suffer.
Sri Sri Ramakrishna Paramahamsa
496
76.28
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     52546
25/06/2018     44301
01/01/2018     43092
28/06/2017     40812
02/08/2017     39724
01/08/2017     33845
06/07/2017     33659
15/05/2017     32920
11/09/2018     29311
14/07/2017     29256
softetechnologies