做作业时看到的 Demo

 1 public class HelloWorld {
 2     public static void main(String[] args) {
 3     outer: 
 4     for(int i = 0;i < 3; i++, System.out.println("\t OUTER "+i))
 5     inner: 
 6         for (int j=0; j<2; j++, System.out.println("\t INNER " + j)){
 7             if (j == 1) {
 8                 System.out.println("\t go1");
 9                 continue outer;
10             }
11             System.out.println(j+" and " + i + ";");
12         }
13     
14     
15     System.out.println("---------------EOF----------------");
16   }
17 }

 

运行结果

 

 

附上:

Java基础break、continue语句的用法

 

posted @ 2019-09-28 11:51  蓝天上的云℡  阅读(198)  评论(0编辑  收藏  举报