Start Coding Now

Enhanced For Loop (For-Each) in Java

Learn about the for-each loop in Java. A simpler way to iterate over arrays and collections.

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);
}

Frequently Asked Questions