How do I break out of nested loops in Java?

Like other answerers, I’d definitely prefer to put the loops in a different method, at which point you can just return to stop iterating completely. This answer just shows how the requirements in the question can be met. You can use break with a label for the outer loop. For example: This prints:

Breaking out of nested loops

It has at least been suggested, but also rejected. I don’t think there is another way, short of repeating the test or re-organizing the code. It is sometimes a bit annoying. In the rejection message, Mr van Rossum mentions using return, which is really sensible and something I need to remember personally. 🙂

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)