Uses a continue statement to simply skip 12 rather than abort the loop - Java Language Basics

Java examples for Language Basics:continue

Description

Uses a continue statement to simply skip 12 rather than abort the loop

Demo Code

public class Main
{
  public static void main(String[] args)
  {//from ww w .ja va 2 s. c o m
    for (int number = 2; number <=20; number += 2)
    {
      if (number == 12)
        continue;
      System.out.print(number + " ");
    }
    System.out.println();
  }
}

Related Tutorials