For loop with no parameters in Java

后端 未结 3 1788
花落未央
花落未央 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:26

    they are entirely the same the only real difference would be either preference (the for construct can be typed marginally faster)

    or the for indicates that is is some iteration that is broken out of by a break or return and a while loop indicates a repeating section of the same thing until a meaningful result appears

提交回复
热议问题