enhanced for loop can be used to modify code example
Example 1: enhanced for-loop,
for (String element : array) { System.out.println("Element: " + element);}
Example 2: enhanced for-loop,
for (int i=0; i < array.length; i++) { System.out.println("Element: " + array[i]);}