for(...)
{
    for(...)
    {
        for(...)
        {
           //如果条件成立则退出到三重循环外,就是aa处
        }
    }
}
//aa

解决方案 »

  1.   

    很少用这样写的,你可以试试,把三个循环写到一个方法内,在最里层循环内加上return
      

  2.   

    除了标号,好像没有别的好方法了  在最外层for循环外加一个标号,然后break到那个标号就可以了
      

  3.   

    // for exemple .
    boolean inCycle = true;
    for(i=0;i<100 && inCycle;i++){
      for(j=0;j<100 && inCycle;j++){
        for(k=0;k<100 && inCycle;k++){
           //... Other codes ...
           if(condition must be break){
             inCycle=false;break;
           }
        }
      }
    }
      

  4.   


    public class test{
    public void test(){
    int i=4;
    ok:for(int j=0;j<10;j++)
    //这是java里面的特定的标号 
    //作用是跟goto语句差不多
    for(int k=0;k<10;k++){
    if(k==i){
    break ok;
    //这里就是break到ok这里
    }
    }

    }
    }你可以百度搜下  我记得好像就是这样用的
      

  5.   


    public class LabelInLoop{
    public static void main(String[] args){
    outer:
    //此处不能有其他语句,因为循环体中使用了outer
    for(int i=0;i<=3;i++)
    {
    for(int j=0;j<=3;j++)
    {
    for(int k=0;k<=3;k++)
    {
    if(k==1 && j==1 && i==1){
    System.out.println("break outer");
    break outer;
    }
    }
    }

    }



    }

    }
      

  6.   

    那还是跳到for上啦,然后再执行for语句啦。我想不执行for语句了
      

  7.   


    public class LabelInLoop{
    public static void main(String[] args){
    outer:
    //此处不能有其他语句,因为循环体中使用了outer
    for(int i=0;i<=3;i++)
    {
    for(int j=0;j<=3;j++)
    {
    for(int k=0;k<=3;k++)
    {
    if(k==1 && j==1 && i==1){
    System.out.println("break outer");
    break outer;
    }
    }
    }

    }
    System.out.println("hello");





    }

    }你运行看看这段代码,
    看是不是输出
    break outer
    hello
      

  8.   

    如果输出 out 说明 没有跳出, 事实上没有输出out , 表明没有执行外层循环, 直接跳出外层
    public static void main(String[] args) {
    out: for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
    if(j == 0){
    break  out;
    }
    }
    System.out.println("out");
    }
    System.out.println("aaa");
    }
      

  9.   

    结束循环,以后不再继续循环,用break;跳出本次循环,用continue;
      

  10.   

    1、用标识,如:2、跳出本层循环,用break;跳出本次循环,用continue;
      

  11.   

    多层嵌套不能break,只能定义方法,直接走到方法去
      

  12.   

    boolean flag = false;
    for(int i=0;(i<length)&&!flag;i++){
        for(方法同上){
          for(方法同上)
            {
                if(找到)
                  flag = true;
             }
    }
    }楼主试试
      

  13.   

    boolean flag = false;
    for(int i=0;(i<length)&&!flag;i++){
        for(方法同上){
          for(方法同上)
            {
                if(找到)
                  flag = true;
             }
    }
    }楼主试试
      

  14.   

    如果编程序 需要用到 类似goto的东西,
    那LZ应该 审核下自己代码了
      

  15.   

    loop:if(...)




    break loop;