- Create a new class named EnhancedLoop.
- Add the main method and the following code.
public class EnhancedLoop{
public static void main(String[] args){
int[] values = {1,22,33,44,23,98,87,34};
for (int value : values){
System.out.println(value);
}
}
}
- Compile and run the program.
$ javac EnhancedLoop.java $ java EnhancedLoop 1 22 33 44 23 98 87 34
Refer to the following video by LearningLad if you need more information on using the For Each loop to iterate through an array.


