Does Java support Mulitiple Inheritance?

后端 未结 5 1807
半阙折子戏
半阙折子戏 2021-01-25 15:03

From the Java fact that all class in Java have a parent class as Object. But the same Java says that it doesn\'t support multiple inheritance. But what this code me

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-25 15:41

    Multiple inheritance means that one class extends two other classes. Multiple inheritance is allowed in e.g. C++. But this is not that same as:

    class Object {
    ...
    }
    
    class B extends Object { //default, not need to be there
    ...
    }
    
    class A extends B {
    ...
    }
    

提交回复
热议问题