接口可以看作是特殊的抽象类,java中可以通过接口实现多继承

解决方案 »

  1.   

    接口就和现实生活中的接口功能差不多.比如 显示器和电脑主机的接口--他提供了显示器和主机通信的方法,但是至于到底显示器和主机怎么通信,他不用管,主机通过这个接口象显示器发指令就可以了java中的接口也一样,可以说是两个对象之间通信的链接,他定义了一组方法让两个(多个)对象访问另外一个实现了这个接口的对象,他只提供方法,至于怎么实现,这个就不关他的事了
    ^_^  不知道这个比如对不对
      

  2.   

    interface like the abstract class;the method in the interface is abstract,you must implement then methods in the derived class. if you don't the derived class is abstract class,too.the params in the interface is final. the params and methods in interface is public in the default model.
      

  3.   

    接口的所有的方法都只有声明,没有实现,好像c里的头文件抽象类里部分方法只有声明,没有实现。接口是不能被继承的,只能实现implements。所有方法都必须被实现。好像为.h文件编写.cpp文件一样。抽象类是被继承的(extends),它的抽象方法(即原来只有声明的那些方法)必须被子类重载(实现)。