Reputation:
I was looking at the AtomicBoolean
class source and found interesting declaration of the for
loop like this:
for (;;) {
//Something
}
What does this loop?
Upvotes: 3
Views: 366
Reputation: 16403
This is an endless loop that will not stop execution if you have no break
statement inside. It's the same as while(true)
.
Upvotes: 1
Reputation: 1039050
What does this loop?
It loops indefinitely. It's like:
while (true) {
}
Upvotes: 0
Reputation:
This is shorthand for an infinite loop. It will continue until a break statement causes execution to escape the loop.
Upvotes: 2
Reputation: 23413
It is an infinite loop. The same you can do with:
while (true) {
//Loops forever.
}
Take a look at the docs.
Upvotes: 10