Counting even numbers with a for loop - Java Language Basics

Java examples for Language Basics:for

Description

Counting even numbers with a for loop

Demo Code

public class Main {
    public static void main(String[] args) {
    for (int number = 2; number <= 20; number += 2)
      System.out.print(number + " ");
        System.out.println();/* ww w .  j a v  a 2 s .co m*/
    }
}

Related Tutorials