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?
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?
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.