Lecture 7
22
for loop
–        start                 test               step
–for (int i = 0;  i < 5;  i=i+1) {
–   System.out.println(2*i + 1); body
– }
–Prints  1, 3, 5, 7, 9 on successive lines
–do start
–if test is true                                                                   do body                                                                         do step                                                                                 go back and test again
–else loop is done, so do first line after body
•Use a for loop when you know how many repetitions you want (else use while loop)
•See ForDemo.java  in JOI