Announcements Exam 1 Grades Posted on Blackboard
Iteration Iteration (Looping): Performing a Series of Statements Multiple Times until Some Condition Is Met. Eliminates the Need for Redundant Coding or Method Calls Many Ways to Loop in JAVA
The while Loop Syntax: while (condition) statement; while (condition) { statement; }
while Example final int MAX = 100; int counter = 0; while (counter < MAX) { System.out.println( counter); counter++; }
Example while Loop int numEmployees,curNum = 0; System.out.print(“Enter Number of Employees: “); numEmployees = scan.nextInt(); if (numEmployees > 0) { while (curNum < numEmployees) System.out.println( “Welcome to CorpLand!” ); curNum++; }