开发者

abstract class&interface [duplicate]

开发者 https://www.devze.com 2023-02-16 02:34 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_高级运维 Possible Duplicate:
This question already has answers here: Closed 11 years ago. 开发者_高级运维

Possible Duplicate:

Interface vs Abstract Class (general OO)

can u tell what is the main difference between abstract class and interface in java.?


The main difference is Abstract class is CLASS and interface is Interface.


An abstract class has one or more methods that are not implemented (i.e. only the method's prototype is declared). It may have one or more methods that are implemented.

In an interface none of the methods are implemented. It only has prototypes for methods and can't have any methods that are implemented unlike an abstract class. Also, more than one interface can be inherited by another class, but multiple inheritance is not allowed when inheriting from abstract classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消