/**
* Created by xabcd on 2019/2/16.
*/
interface A
{
int i = 10;
public void sayI();
}
interface E
{
int x = 40;
public void sayE();
}
interface B extends A,E{
int j = 20;
public void sayJ();
}
class C implements B {//此类实现了B接口,所以要覆写ABE中全部的抽象方法
public void sayI()
{
System.out.println("i=" + i);
}
public void sayJ()
{
System.out.println("j=" + j);
}
public void sayE()
{
System.out.println("e=" + x);
}
}
/**
* Created by xabcd on 2019/2/16.
*/
public class test_jiekou
{
public static void main(String[] args)
{
C c = new C();
c.sayI();
c.sayJ();
}
}
结果:
i=10
j=20