for statements in java code example
Example 1: java for
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
System.out.println(i);
}
Example 2: java loop
for (int i = 0; i < 10; i++) {
System.out.println(i);
}
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
System.out.println(i);
}
for (int i = 0; i < 10; i++) {
System.out.println(i);
}