Uses a continue statement to skip the number 12 rather than stop counting altogether when it reaches 12: - Java Language Basics

Java examples for Language Basics:continue

Description

Uses a continue statement to skip the number 12 rather than stop counting altogether when it reaches 12:

Demo Code

public class Main
{
  public static void main(String[] args)
  {//  w w w.  jav  a2  s .co  m
    int number = 0;
    while (number < 20)
    {
      number += 2;
      if (number == 12)
        continue;
      System.out.print(number + " ");
    }
    System.out.println();
  }
}

Related Tutorials