立即学习:https://edu.csdn.net/course/play/27274/361065?utm_source=blogtoedu
1.接口更好的实现程序的抽象过程,相当于先告诉你有什么方法,然后在编写一个类,去写这些方法。interface和implements。具体:interface Animal{ }
class Dog implements Ainmal{ }
接口不能被实例化,只能实例化类。
2.接口是可以被继承的,interface 接口1 extends 接口2;然后在类里接口1就有了接口2的方法