This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void enhancedForLoop(){ | |
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
System.out.println("\nEXAMPLE: Enhanced For Statement"); | |
for (int temp: arr){ // Create a temporary variable, same type as array values. For | |
// loop assign array value to the temporary variable | |
System.out.println("Enhanced = " + temp); | |
} | |
} |