while(true):

public class Test {
    public static void main(String[] args) {
        while(true) {
        }
    }
}

在?看看汇编
Java中for(;;)和while(true)的区别

for( ; ; )

public class Test2 {
    public static void main(String[] args) {
        for(;;) {
        }
    }
}

kk汇编
Java中for(;;)和while(true)的区别
好吧,没有区别 ( ・_ゝ・)

查了一下,这么写的大佬们应该是受早期C语言的影响,C语言的话写for( ; ; )效率会快一点,所以自己喜欢用哪种就哪种吧

相关文章:

  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-10-18
猜你喜欢
  • 2021-11-12
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
相关资源
相似解决方案