The continue statement: skips all or part of a loop iteration : Continue Statement « Statement Control « Java Tutorial






public class MainClass {

  public static void main(String[] arg) {
    int limit = 10;
    int sum = 0;
    for (int i = 1; i <= limit; i++) {
      if (i % 3 == 0) {
        continue;
      }
      sum += i;
    }
    System.out.println(sum);
  }

}
37








4.9.Continue Statement
4.9.1.The continue Statement
4.9.2.The continue statement: skips all or part of a loop iteration
4.9.3.The Labeled continue statement
4.9.4.Calculating Primes: using continue statement and label