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