Java examples for Language Basics:for
Counting even numbers with a for loop
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*/ } }