Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment