1 public static void main(String[] args) 2 { 3 System.out.println("main"); 4 w: for (int x = 0; x < 3; x++) 5 { 6 for (int y = 0; y < 4; y++) 7 { 8 System.out.println("x=" + x); 9 break w; 10 } 11 } 12 }
相关文章
- 12-05循环跳出--只打印 x = 0 一次;
2021-12-05 00:08:07
1 public static void main(String[] args) 2 { 3 System.out.println("main"); 4 w: for (int x = 0; x < 3; x++) 5 { 6 for (int y = 0; y < 4; y++) 7 { 8 System.out.println("x=" + x); 9 break w; 10 } 11 } 12 }