interface animal {
int a = 1;
int eat();
}
动物接口里面有成员变量a和方法eat();,虽然没有修饰符修饰但是接口都有默认修饰符,即上面的接口同下面的接口
interface animal {
public static final int a = 1;
public int eat();
}
所以接口的成员变量都是静态的不可改变的,而且修饰符可以省略;所有的方法都是public修饰的而且也是可以省略的
interface animal {
int a = 1;
int eat();
}
动物接口里面有成员变量a和方法eat();,虽然没有修饰符修饰但是接口都有默认修饰符,即上面的接口同下面的接口
interface animal {
public static final int a = 1;
public int eat();
}
所以接口的成员变量都是静态的不可改变的,而且修饰符可以省略;所有的方法都是public修饰的而且也是可以省略的