public class ForLoopColorsExample2
{
public static void main(String args[])
{
// ForLoopColorsExample2
String colors[] = {"red", "yellow", "blue", "purple", "green"};
for (int i = 0; i < colors.length; i++)
{
System.out.println(colors[i]);
}
}
}
red yellow blue purple green
--- Output Ends ---
- javac ForLoopColorsExample2.java
- java ForLoopColorsExample2