int i = 1; int j; System.out.println("break example"); out:while (i <= 4) { i++; j = 0; while (j <= 5) { j++; if (j == 3) { break out; } System.out.println(j); } } i = 1; System.out.println("continue example"); out2:while (i <= 4) { i++; j = 0; while (j <= 5) { j++; if (j == 3) { continue out2; } System.out.println(j); } }
返回[JAVA]流程控制語法目錄
沒有留言:
張貼留言