<p>我刚看到一篇关于Python循环的帖子:<a href="https://stackoverflow.com/questions/39188827/trying-to-understand-python-loop-using-underscore-and-input">Trying to understand Python loop using underscore and input</a></p>
<p>有一种方法可以在python中不使用“variable name”进行循环:</p>
<pre><code>for _ in range(10):
print("Hello world")
</code></pre>
<p>Java方法:</p>
^{pr2}$
<p>日蚀警告我:</p>
<blockquote>
<p>'_' should not be used as an identifier, since it is a reserved
keyword from source level 1.8 on.</p>
</blockquote>
<p>也许我应该坚持写下来</p>
<pre><code>for (int i = 0; i < 10; i++) {
System.out.println("Hello world");
}
</code></pre>
<p>使用一个(也许)不必要的整数变量。在</p>
<p>有没有其他方法可以像python循环一样编写简单的java循环,也许更优雅?在</p>