What do two semicolons mean in Java for loop?

前端 未结 5 1233
渐次进展
渐次进展 2020-12-17 07:51

I was looking inside the AtomicInteger Class and I came across the following method:

/**
 * Atomically increments by one the current value.
 *
          


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-17 08:31

    It is equivalent to while(true).

    A for-loop has three elements:

    • initializer
    • condition (or termination expression)
    • increment expression

    for(;;) is not setting any of them, making it an endless loop.

    Reference: The for statement

提交回复
热议问题