j****s 发帖数: 34 | 1 请教各位,
What is the difference between "interface" and " abstract class"?
他们都可用来实现多态,但是不明白他们的区别,请大家指点,谢谢! | g*****g 发帖数: 34805 | 2 Basically interface is an abstract class without instance variable.
【在 j****s 的大作中提到】 : 请教各位, : What is the difference between "interface" and " abstract class"? : 他们都可用来实现多态,但是不明白他们的区别,请大家指点,谢谢!
| c*****t 发帖数: 1879 | 3 You can implement multple interfaces but can only extend one abstract
class :D
Other than that, abstract class/interfaces are about the same. However,
if you can put things into an interface, you should do so since you can
implement more interfaces.
【在 j****s 的大作中提到】 : 请教各位, : What is the difference between "interface" and " abstract class"? : 他们都可用来实现多态,但是不明白他们的区别,请大家指点,谢谢!
| j****s 发帖数: 34 | 4 精辟!!!
谢谢!!!
【在 c*****t 的大作中提到】 : You can implement multple interfaces but can only extend one abstract : class :D : Other than that, abstract class/interfaces are about the same. However, : if you can put things into an interface, you should do so since you can : implement more interfaces.
| y**a 发帖数: 13 | 5 another thing is that you can implement some methods in abstract class; but
you can't do it in interface.
【在 c*****t 的大作中提到】 : You can implement multple interfaces but can only extend one abstract : class :D : Other than that, abstract class/interfaces are about the same. However, : if you can put things into an interface, you should do so since you can : implement more interfaces.
| y**a 发帖数: 13 | 6 actually you can define instance variables in interface, but they are all
final.
【在 g*****g 的大作中提到】 : Basically interface is an abstract class without instance variable.
|
|