直接看代码:

class ForLoop{  
    public static void main(String[] args){  
       //jump from outer loop  
        outer:for(int i=0;i<5;i++){  
            for(int j=0;j<10;j++){  
                if(j==5)  
                   break outer;  
                 System.out.print("*");    
            }  
            System.out.print("\r\n");    
        }          
    }  
} 

另外,continue也可以用这个方法。

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2021-12-25
  • 2022-01-09
  • 2021-06-06
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-01-02
相关资源
相似解决方案