Enhanced for Loop (For-Each) in Java


The enhanced for loop is useful for iterating through arrays and collections.

Source Code

String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
    System.out.println(i);
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments