If one class is derived from another that is derived from Object, is that “multiple inheritence”

前端 未结 7 1509
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 09:56

The fact about Java is that it does not support the multiple inheritance.

But I have a question that the base class of all java classes is Object.

Now we have tw

7条回答
  •  抹茶落季
    2021-01-29 10:30

    The concept of Multiple Inheritance means, that you can have a class A, B and C where A is derived from B and C like this:

    class A extends B, C {}
    

    This is not possible in Java.

    What you describe is a straightforwar inheritance with a direct line of descendenats.

    class A {};
    class B extends A {}
    class C extends B {}
    

    You don't really need Multiple Inmheritance though, because with Interfaces you can basically achieve the same in a much cleaner way.

提交回复
热议问题