for (declaration; conditions; procedures) {
......
}
declaration --> declare variables varid only in the for block
conditions --> the roup conditions
procedure --> these are done after the body procedure
___
int[] x = {1,2,3,4,5};
for (int i = 0, n = x.length; i < n; i++) {
System.out.println(x[i]);
}
___
Nested loop
int[][] x = new int[2][];
x[0] = {1,2,3};
x[1] = {11,12,13};
for (int i = 0, n = x.length; i < n; i++) {
for (int j = 0, m = x[i].length; j < m; j++) {
System.out.println(x[i][j]);
}
}
break --> go out of the loop right now
continue --> go to the next iteration right now
return --> go out of the method, returning the value or "nothing".