for循环中的条件保持空白,代码编译并运行.
for(int i=0; ; i++)
System.out.print(i); //this code does not execute
//code after this does not execute
Run Code Online (Sandbox Code Playgroud)
但是,我不明白这是如何以及为什么这是可能的.
如果它没有打印任何内容,则意味着您根本没有到达此 for 循环。
如果达到了,它应该打印从 0 开始的所有数字。
这是一个无限循环,打印 0, 1, 2, ...
您的问题在其他地方(可能在 for 循环之前)。
| 归档时间: |
|
| 查看次数: |
192 次 |
| 最近记录: |