public static void main(String args[]) { int i=10,j=10; outer: while (i > 0) { inner: while (j > 0) { if (j == 8) break outer; System.out.println("内层循环"); j--; } System.out.println("外层循环"); } System.out.println("已跳出循环"); }
时间: 2024-12-29 23:10:23
public static void main(String args[]) { int i=10,j=10; outer: while (i > 0) { inner: while (j > 0) { if (j == 8) break outer; System.out.println("内层循环"); j--; } System.out.println("外层循环"); } System.out.println("已跳出循环"); }