Question: Enhanced for Loop Write an enhanced for loop that takes a given Array called words and prints each element to the console. import java.io .

Enhanced for Loop
Write an enhanced for loop that takes a given Array called words and prints each element to the console.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class EnhancedForLoopQuestion {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String a = in.nextLine();
String b = in.nextLine();
String c = in.nextLine();
String d = in.nextLine();
String e = in.nextLine();
String[] words ={a, b, c, d, e};
/***** DO NOT CHANGE THE CODE ABOVE THIS LINE *****/
// WRITE YOUR CODE HERE
}
}
STDOUT
Expected STDOUT
Bird
Cat
Dog
Lizard
Fish

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!