Abstract classes and Multiple Inheritance

前端 未结 5 1469
南笙
南笙 2021-01-19 15:02

We can achieve the same functionality as interfaces by using abstract classes, So why java doesn\'t allow the following code?

abstract class Animals
{
    pu         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 15:53

    In ABSTRACT class,we can't extends multiple abstract classes at a time. but In INTERFACE, we can implements multiple interfaces at time.

    Therefore , interfaces are used to achieve multiple inheritance in java.

提交回复
热议问题