Answers for "java break several loops"

2

java break 2 for loops

public class Test {
    public static void main(String[] args) {
        outerloop:
        for (int i=0; i < 5; i++) {
            for (int j=0; j < 5; j++) {
                if (i * j > 6) {
                    System.out.println("Breaking");
                    break outerloop;
                }
                System.out.println(i + " " + j);
            }
        }
        System.out.println("Done");
    }
}
Posted by: Guest on March-11-2021
0

java break 2 for loops

break outerloop;
Posted by: Guest on April-06-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language