Java: for(;;) vs. while(true)

后端 未结 9 1943
予麋鹿
予麋鹿 2020-12-01 15:29

What is the difference between a standard while(true) loop and for(;;)?

Is there any, or will both be mapped to the same bytecode after com

9条回答
  •  半阙折子戏
    2020-12-01 16:11

    On Oracle Java 7 you get the same byte code. You cannot tell from the byte code which was using in the original. Which is best is a matter of taste. I use while(true)

提交回复
热议问题