what is the advantage of interface over abstract classes?

前端 未结 9 1904
野的像风
野的像风 2021-02-01 05:48

In Java, abstract classes give the ability to define both concrete and abstract methods whereas interfaces only give the ability to implement abstract methods. I believe overrid

9条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 06:30

    Interfaces are useful because Java doesn't have multiple inheritance (but you can implement as many interfaces as you like).

    Abstract classes are useful when you need concrete behaviour from the base class.

提交回复
热议问题