HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
1. Feel Free to ask and submit anything on and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.

corejava-inheritance: How can you say that java does not support multiple inheritance?

As we know that all classes inherit the Object class by default. Now If we have class A and a sub class of A is Class B. Then class B inherits two classes Class A and Object. That is multiple inheritance.

corejava x 353
inheritance x 7
Posted On : 2014-05-09 17:20:25.0
profile Rishi Kumar - Rishi Kumar


First i think you should focus on the actual meaning of multiple inheritance - Multiple inheritance is about multiple-direct-inheritance. That is a class can have two immediate parents. In java no class is allowed to have two immediate parent classes.
A class that extends that other class, but it extends Object, too, so you are still in one line of inheritance, not multiple inheritance. A single class can´t have two immediate parent classes it can have grandparent class though. Let us make it better understandable by following example:

If A extends B and B extends C, is not the same thing as A extends both B and C. In java a class that has no parent class by default its parent would be Object class. Consider following example:

class Animal {

class Cat extends Animal {

class Tiger extends Cat {

In the above example Tiger inherits from Cat which inherits from Animal which (by default) inherits from Object. In above case Object class is the parent of Animal and grandparent of Cat class. So in this way we says that Object class is the parent of all classes.

Posted On : 2014-05-09 18:01:26
Satisfied : 2 Yes  0 No
profile Garima Gupta - Garima Gupta
Reply This Thread

Post Answer
Please Login First to Post Answer: Login login with facebook -