printing out enums java code example
Example: printing out enums java
/**
* A Java enum toString example.
* @author alvin alexander, alvinalexander.com
*/
public class JavaEnumToStringExample
{
public static void main(String[] args)
{
// loop through the enum values, calling the
// enum toString method for each enum constant
for (Day d: Day.values())
{
System.out.println(d);
}
}
}
enum Day
{
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}