University of Cincinnati logo and link  
Iteration and Loops in Java
 
  UC ingot 
Iterations allow us to execute the same lines of code multiple times.  In Java 1.4.2, we can use the while loop, the do-while loop, and the for loop.  When would you use these loops?  Think of some examples.

When designing a loop, you may end up with an infinite loop, either intentionally or unintentionally. 

When designing variables, be careful to consider their scope in a loop.  The book mentions several other 'watch-outs'.  Among them:
  • Don't put a semicolon after the close parenthesis of the loop statement.  An open curly should be the next symbol.
  • Most of our loops use the > or < operators.