Nested break continue

suggest change

It’s possible to break / continue to an outer loop by using label statements:

outerloop:
for(...) {
    innerloop:
    for(...) {
        if(condition1)
            break outerloop;

        if(condition2)
            continue innerloop; // equivalent to: continue;
    }
}

There is no other use for labels in Java.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents