首页 > 代码库 > break跳出嵌套循环体

break跳出嵌套循环体

 1 package com.wh.Object; 2  3 public class Test { 4  5     public static void main(String[] args) { 6         // TODO Auto-generated method stub 7         //注意,OK后面是冒号,而不是分号,切记 8         ok: 9         for (int i = 0; i < 10; i++) {10             for (int j = 0; j < 10; j++) {11                 System.out.println("OK");12                 break ok;13             }14         }15     System.out.println("xxxx");16     }17 18 }

 

break跳出嵌套循环体