> 其他 >
interface在这段代码里是什么意思,
下面的程序编译运行后的输出结果是( )
public class Test implements A {
int x=10;
public static void main(String args[]) {
Test c1 = new Test();
System.out.println(c1.x+A.k);
}
}
interface A {
intk= 10;
}
人气:368 ℃ 时间:2020-07-03 18:22:08
解答
输出应该是20
Test类实现了一个A接口,接口A中包含了一个变量k,实现该接口的类都可以使用该变量
推荐
猜你喜欢
© 2026 79432.Com All Rights Reserved.
电脑版|手机版