0

Every class is inherited from Object class and they will also extend some other parent class in inheritance why is it not considered as multiple inheritance.

  • 1
    Because every class has one and only one parent. In multiple inheritance you have more than one parent. An ancestor is *not* a parent. – Federico klez Culloca Oct 16 '20 at 11:29
  • can you please eloborate the answer – anonymous Oct 16 '20 at 11:34
  • I'm not sure how much more detail can be added, tbh – Federico klez Culloca Oct 16 '20 at 11:42
  • 1
    Short answer: in an object hierarchy chain, only the "topmost" class implicitly extends Object - the rest of them don't have to. Look at the object hierarchy for the [Window class](https://docs.oracle.com/javase/7/docs/api/java/awt/Window.html) for a good example. `Window` extends `Container`, which extends `Component`, which extends `Object`. Only the "topmost" class "directly" extends Object. – EJoshuaS - Stand with Ukraine Oct 16 '20 at 12:28
  • @FedericoklezCulloca I think that the OP is missing the parent/ancestor distinction... I suspect that they're under the impression that `Object` is the parent of every single object (rather than the ancestor). – EJoshuaS - Stand with Ukraine Oct 16 '20 at 14:50
  • @EJoshuaS-ReinstateMonica possible. If that's the case I'd say the answers in the duplicate you found explain this well enough :) – Federico klez Culloca Oct 16 '20 at 15:03

1 Answers1

0

It's because in Java you can directly inherit from only one parent class. We would consider multiple inheritance if you'd be able to extend from multiple classes but that's not a thing in Java.

Hawwaru
  • 5
  • 2
  • 5