1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/* Java continue statement with label example. This example shows how to use java continue statement to skip to next iteration of the labeled loop. */ public class JavaContinueWithLabelExample { public static void main(String[] args) { int intArray[][] = new int[][]{{1,2},{2,3}}; Outer: for(int i=0; i < intArray.length; i++) { for(int j=0; j < intArray[i].length ; j++) { if(intArray[i][j] == 3) continue Outer; System.out.println("Element is : " + intArray[i][j]); } } } } /* Element is : 1 Element is : 2 Element is : 2 */ |
Add Comment