Java examples for Language Basics:break
To use a labeled loop, add the label before the initial part of the loop with a colon between the label and the loop.
Then, when you use break or continue, add the name of the label after the keyword itself.
public class Main { public static void main(String[] arguments) { out: for (int i = 0; i < 10; i++) { for (int j = 0; j < 50; j++) { if (i * j > 400) { System.out.println("a"); break out; }/*from w w w. j a v a2s.c o m*/ } } } }