Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java continue with Nested Loop

class Main {
  public static void main(String[] args) {
    int i = 1, j = 1;
    // outer loop
    while (i <= 3) {
      System.out.println("Outer Loop: " + i);
      // inner loop
      while(j <= 3) {
        if(j == 2) {
          j++;
          continue;
        }
        System.out.println("Inner Loop: " + j);
        j++;
      }
      i++;
    }
  }
}
 
PREVIOUS NEXT
Tagged: #Java #continue #Nested #Loop
ADD COMMENT
Topic
Name
6+5 =