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

前端 未结 7 1488
没有蜡笔的小新
没有蜡笔的小新 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.

    0 讨论(0)
提交回复
热议问题