如何从多层for循环跳出最外层。。。当然其它方法也可以设置标志变量如flag。。

转载自:https://blog.csdn.net/huolei_blog/article/details/23846313

package com.cn.test6;
//如何从多层for循环跳出最外层。。。当然其它方法也可以设置标志变量如flag。。
public class test3 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        lable1:
            for(int i=0;i<2;i++){
                System.out.println("第一层"+i);
                for(int j=0;j<3;j++){
                    System.out.println("第二层"+i+" "+j);
                    if(j==1){
                        break lable1;
                    }
                }
    
            }
            System.out.println("出来了");
    }
}
原文地址:https://www.cnblogs.com/hd92/p/11326907.html