/** * While1 --- A program to demonstrate the while statement * while iterates through a segment of code * as long as the condition is true. * Conditions may be simple or compound. * @author Blanca Polo */ public class While1{ /** * Demonstrates the use of the while statement * @param arg A string array containing the command line arguments. * @return No return value. */ public static void main(String arg[ ]){ final int iEnd = 10; //constant determines the end of loop int i = 1; //variable that counts iterations while(i < iEnd ){ System.out.println("\tThe value of i is: " + i); i = i - 100; //the same can be done with i = i+1; } // while loop ends System.out.println("out of here!!!"); } //closes main }// closes class While1 /* Changes for class - different increments for the variable. - demonstrate how the loop may never execute. - demonstrate how an infinite loop can happen. */