How for( ; ;) is infinite loop?
for-loop, infinite-loop, java, language-agnostic, while-loop
Solution
According to Java Language Specification, section 14.14.1.2:
`for ( ForInit`opt` ; Expression`opt` ; ForUpdate`opt` ) Statement`
If the `Expression` is not present, or it is present and the value resulting from its evaluation (including any possible unboxing) is `true`, then the contained `Statement` is executed.
Since the standard treats missing expressions and expressions evaluating to `true` in the same way, the `for` loop with the missing expression is equivalent to an infinite loop.
Problem
Like many other question explained that `while(true) {}` is an infinite loop and so is `for( ; ;)` my question is `while(true)` makes sense the conditions is always true but there is no vivid condition `true/false` in `for( ; ;)` so how is the later an infinite loop.