For-Each Loop
Used exclusively to loop through elements in an array (or other data collections).String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
System.out.println(i);
}
Learn about the for-each loop in Java. A simpler way to iterate over arrays and collections.
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
System.out.println(i);
}