Example Application: LOOP - FOR
for (statement 1; statement 2; statement 3) {
// code block to be executed in loop
}
for (int i = 0; i < 11; i++) {
System.out.println("i: " + i);
}
int[] values = new int[] { 3, 4, 5 };
for (int i = 0; i < values.length; i++) {
System.out.println("i: " + values[i]);
}
int i;
for (i = 10; i >= 0; i--) {
System.out.println("i: " + i);
}
int i;
for (i = 0; i <= 10; i += 2) {
System.out.println("i: " + i);
}
int i;
for (i = 10; i >= 0; i -= 2) {
System.out.println("i: " + i);
}