Java
for-loop vs. for-each loop

by Benny Neugebauer

String[] names = new String[]{"Anna", "Bob", "Clara"};
for (int i = 0; i < names.length; i++) {
  System.out.println("Hello " + names[i] + "!");
}

String[] names = new String[]{"Anna", "Bob", "Clara"};
for (String name : names) {
  System.out.println("Hello " + name + "!");
}