- public static void main(String[] args) {
- over: while (true) {
-
- System.out.println(1);
-
- for (int x = 0; x < 3; x++) {
- System.out.println(2);
- for (int y = 0; y < 3; y++) {
- System.out.println(3);
- // break跳出当前for循环,如果定义一个标记,跳出指定循环
- break over;
- }
- }
- }
- System.out.println(4);
- }
复制代码
|
|