For loop with no parameters in Java

后端 未结 3 1789
花落未央
花落未央 2021-02-19 05:38

I am looking at somebody else\'s code and I found this piece of code:

for (;;) {

I\'m not a Java expert; what is this line of code doing?

3条回答
  •  一个人的身影
    2021-02-19 06:35

    Remember the three clauses of the for() are [1] initialization [2] termination and [3] increment. Since the termination clause is empty the loop never terminates. This is directly taken from C syntax.

提交回复
热议问题