Continue statement in for each loop in java

Java Programming Language / Decision Making and Looping in java

26334

Program:

 class ContinueStatementInForEachLoop {

   public static void main(String args[]) {
      int [] numbers = {14, 22, 31, 42, 58};

      for(int x : numbers ) {
         if( x == 30 ) {
            continue;
         }
         System.out.print( x );
         System.out.print("\n");
      }
   }
}

Output:

14
22
31
42
58
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.