使用continue忽略本次循环中剩下的语句


 1 public class Test
 2 {
 3 
 4     public static void main(String[] args)
 5     {
 6         for(int i=0;i<10;i++)
 7         {
 8             if(i==5)
 9             {
10                 continue;
11             }
12             //当i==5时,下面语句不再被执行,然后继续下一次循环
13             System.out.println("hello");
14             System.out.println("小明");
15         }
16     }
17 }

 

 

 

posted @ 2016-10-16 23:44  明天会更好!!!!  阅读(241)  评论(0)    收藏  举报