请看这道题……

laughing 2002-03-21 01:08:53
interface Foo{
int k=0;
}
public class Test implements Foo{
public static void main(String args[]){
int i;
Test test =new Test();
i=test.k;
i=Test.k;
i=Foo.k;
}
}
what is the result?
...全文
185 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gularess 2002-03-21
  • 打赏
  • 举报
回复
You will get compile error at i=Test.k; and i=Foo.k; because k is not static.
RedGuest 2002-03-21
  • 打赏
  • 举报
回复
应该都可以
interface里的成员变量自动变为final static 修饰

23,409

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧