单选题 Java
题号 #2242933

阅读下列代码段。
class Test implements Runnable{
public int run(){
int i=0:
while(true){
i++:
System.OUt.println("i="+i);
}
}
}
上述代码的编译结果是(  )。

进入在线模考

参考答案

D

答案解析

D。【解析】while的循环控制条件可以为true,run()方法没有返回值,所以不能是int型,故此程序不能通过编译。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考