Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?

后端 未结 18 2046
囚心锁ツ
囚心锁ツ 2020-11-22 14:55

Java doesn\'t allow multiple inheritance, but it allows implementing multiple interfaces. Why?

18条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 15:41

    It is said that objects state is referred with respect to the fields in it and it would become ambiguous if too many classes were inherited. Here is the link

    http://docs.oracle.com/javase/tutorial/java/IandI/multipleinheritance.html

提交回复
热议问题