Inheriting an abstract class vs implementing an interface
This question already has an answer here:
抽象类可以有非静态变量。
There are some important differences between abstract class and interface. Some of them are listed below.
Abstract class can have implementation in it but interface can't.
In interface you can have only static final variable ( all the values declared in intrface is automatically constant and static Ie immutable variables ) but in abstract class you can have mutable variables.
Abstract class can be extended and only one abstract class can use for this but you can implement multiple interface in a class.
上一篇: Java中的接口是什么?
下一篇: 继承抽象类与实现接口