public class TestInterfaceDemo {
public static void main(String[]args) {
C c = new C();
c.say1();
c.say3();
System.out.println(c.say4());
c.say2();//我用say2输出的i,结果也为1;
}
}
interface A {
int i = 1;
public void say1();
}
interface B {
int j=2;
public void say2();
}
interface E extends A,B {
int k=3;
public void say3();
public int say4();
}
class C implements E {
public void say1() {
System.out.println(i);
}
public void say2() {
System.out.println(i);
}
public int say4() {
return i;
}
public void say3() {
}
}