interface接口的修饰符
可以用public修饰,或者使用默认的修饰符(不写修饰符),但是不可以使用private或者protected修饰
interface接口方法
默认的修饰符是 public abstract;不可以使用private或者protected修饰。
备注:
1.在JDK1.8中,接口可以定义静态方法,可以直接用接口名调用。
public interface Main{
static int ss() {
return 0;
}
}
2.在JDK1.8中,接口可以使用default关键字定义非抽象方法,实现该接口的时候不用实现非抽象方法,当然你也可以选择重写。
public interface Main{
default int ss() {
return 0;
}
}
interface变量属性
默认的修饰符是 public static final,