-2

Why a subclass cannot have multiple superclass?

And if multiple inheritance is not possible in Java, then why a subclass B(say) can have a superclass A(say) and also has the Object class which is the superclass of all classes?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
  • also duplicates [Multiple inheritance in Java or not?](http://stackoverflow.com/q/14692537/296974). – glglgl Jul 01 '15 at 03:01

1 Answers1

3

Java doesn't support multiple inheritance.

The simplest multiple inheritance is like this:

A        B
 \      /
  \    /
   \  /
    C

While your example in Java is like this:

Object
  |
  |
  |
  A
  |
  |
  |
  B

which is multiple levels of single inheritance.

Yu Hao
  • 119,891
  • 44
  • 235
  • 294