[单项选择题] 阅读下列代码段 class TestimplementsRunnable{ publicintrun(){ inti=0; while(true){ i++; System.out.println("i="+1); } } } 上述代码的编译结果是( )。
A.程序通过编译并且run()方法可以正常输出递增的i值
B.程序通过编译,调用run()方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run()方法的返向值类型不是void
参考答案:
D问题解析:
while的循环控制条件可以为“true”,run方法没有返回值,所以不能是int型,故此程序不能通过编译。

![[单项选择题] 阅读下列代码段 class TestimplementsRunnable{ publicintrun(){ inti=0; while(true){ i++; System [单项选择题] 阅读下列代码段 class TestimplementsRunnable{ publicintrun(){ inti=0; while(true){ i++; System](http://www.mshxw.com/aiimages/31/258277.png)
