Does Java support Mulitiple Inheritance?

后端 未结 5 1806
半阙折子戏
半阙折子戏 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 16:01

    Multiple inheritance is having more than 1 direct base class. The example you have given is single inheritance.

    For example, if you have 3 classes A, B and C...

    public class A extends B
    

    with

    public class B extends C
    

    is still just single inheritance.
    Multiple inheritance would be

    public class A extends B, C
    

提交回复
热议问题