interface vs abstract class
1.Abstract classes are meant to be inherited from, and when one class inherits from another it means that there is a strong relationship between the 2 classes.
- Java does not allow multiple inheritance. However, a class can implement multiple interfaces.
- An abstract class can have non-abstract methods with actual implementation details. An interface, however, can not provide any method definitions.
An interface is a collection of abstract methods. Interface cannot be instantiated. An interface does not contain any constructors. All of the methods in an interface are abstract.
抽象类也不能被实例化。 子类必须实现抽象类的所有抽象方法。