首页 > 代码库 > 跳出多重循环

跳出多重循环

/**
* Created by chengtao on 17/1/3.
*/
public class HH {
public static void main(String args[]){

OK:
for (int i =0;i<5;i++){
System.out.println();
OK_1:
for (int j =0;j<6;j++){
int k = getK();
switch (k){
case 8:
System.out.println(i);
break OK;
case 4:
System.out.println(i);
break OK_1;
}
System.out.println("j --->" + j);
}
System.out.println("i -------->" + i);
}

}

public static int getK(){
return 4;
}
}

跳出多重循环