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