Java loops
From wikinotes
for loop
// statement1: run once before starting loop // statement2: while statement true, looping continues // statement3: execute once per loop for (int i=0; i < 10; i++){ // ... }
for each loop
This operates exclusively on arrays.
String classnames = {"andrew", "will", "ryan"}; for (String name: classnames){ System.out.println(name); }
while loop
while (x < 10) { x++; }
break/continue
break;
ends a loopcontinue;
skips to next iteration of loop