Java examples for Language Basics:while
Even number Counter with a do-while loop instead of a while loop
public class Main { public static void main(String[] args) {// ww w .j a v a2s. co m int number = 2; do { System.out.print(number + " "); number += 2; } while (number <= 20); System.out.println(); } }