continue statement with label - Java Language Basics

Java examples for Language Basics:continue

Description

continue statement with label

Demo Code


public class Main {
 
  public static void main(String[] args) {
   /*from   w ww .j ava 2s . co m*/
    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]);
      }
    }
     
  }
}

Result


Related Tutorials