Member 2. An abstract class can have its own attributes and methods, the interface can have only public constants,
3. An abstract class dispensable, an approach to interface no constructor
4. Abstract class single inheritance, interface multiple inheritance
CodePudding user response:
Abstract class using the abstract keyword modifiers; Interface using the interface modification,Abstract class has a constructor (don't write have implicit constructor), but can't be instantiated; Interface is not a constructor,
Abstract class can have the abstract methods, in general only abstract methods in the interface,
An abstract class can have variable; In the interface can be constant
An abstract class can only single inheritance class; Interfaces can inherit multiple
The implementation class can inherit a abstract class; But you can implement multiple interfaces
CodePudding user response:
https://blog.csdn.net/MrBaymax/article/details/84328918CodePudding user response:
We can see this article: the difference between abstract class and interfaceCodePudding user response: