enum Week {
Monday, Tuesday, Wednesday, Thursday, Friday, Saturaday, Sunday
}
public class MainClass {
public static void main(String args[]) {
Week aWeekDay;
aWeekDay = Week.Monday;
// Output an enum value.
System.out.println("Value of aWeekDay: " + aWeekDay);
System.out.println();
aWeekDay = Week.Friday;
// Compare two enum values.
if (aWeekDay == Week.Friday)
System.out.println(" Friday.\n");
}
}
|