跳出多重循环

Posted 为爱奋斗不息

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了跳出多重循环相关的知识,希望对你有一定的参考价值。

/**
* 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;
}
}

以上是关于跳出多重循环的主要内容,如果未能解决你的问题,请参考以下文章

java之跳出多重循环

Java中如何跳出多重循环?

JS 跳出多重循环

Java跳出多重循环

Python跳出多重循环的方法

python跳出多重循环的方法