Use Labeled continue statement in Java
Description
The following code shows how to use Labeled continue statement.
Example
/* www .jav a 2 s. co m*/
public class Main {
public static void main(String[] args) {
int limit = 20;
int factorial = 1;
OuterLoop: for (int i = 1; i <= limit; i++) {
factorial = 1;
for (int j = 2; j <= i; j++) {
if (i > 10 && i % 2 == 1) {
continue OuterLoop;
}
factorial *= j;
}
System.out.println(i + "! is " + factorial);
}
}
}
The code above generates the following result.