接口

接口            

是程序的功能扩展

interface

implements 实现

可以被类多实现

只有在接口与接口间存在多继承

 

 

 接口的成员(字段 + 方法)默认都是 public 的,并且不允许定义为 private 或者 protected

public interface InterfaceExample {
    void func1();
    default void func2(){
        System.out.println("func2");
    }
    int x = 123;
    public int z = 0;       // Modifier 'public' is redundant for interface fields
}


posted @ 2018-10-15 16:24  StingLon  阅读(149)  评论(0)    收藏  举报