0

In java by default all classes are inherit from Object class and even we can also inherit the classes.

class A{ // default **Object class** is extended

}
class B extends A{ 
           //default **Object class** is extended and also **class A** extended.
}

Then why we say that java doesn't support multiple inheritance through classes?

Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51
  • 1
    because at some point of the inheritance chain you will get to a class that inherits from object, but you can´t inherit from two classes at the same time. – SomeJavaGuy Jan 13 '16 at 07:09
  • @Kevin Esche That comment is the logical fallacy known as "begging the question". – Erwin Smout Jan 13 '16 at 07:19

1 Answers1

1

It is just to remove ambiguity, because multiple inheritance can cause ambiguity in few scenarios. One of the most common scenario is Diamond problem.

Look at this page : http://www.instanceofjava.com/2014/12/why-java-does-not-supports-multiple.html

Shiladittya Chakraborty
  • 4,270
  • 8
  • 45
  • 94