// Author: Kiri Wagstaff, wkiri@cs.cornell.edu // Date: June 28, 2001 public class WhileLoop { public static void main(String[] args) { // Output all the numbers from 1 to 20 that are // evenly divisible by 3: // Loop: setup int checkNum = 1; int endVal = 20; // Loop: check condition while (checkNum <= endVal) // while (true) { // Loop: processing if (checkNum % 3 == 0) { System.out.println(checkNum + " is divisible by 3."); } // Loop: update checkNum++; } } }