Enumerations in C are types which are restricted to certain constants. Variables of an enumeration type can only be set with values from the enumeration.
enum workdays { monday, tuesday, wednesday, thursday, friday };
enum workdays today;
today = tuesday;
today = friday;
today = sunday; // Error at compile time.
enum weekend { saturday = 1, sunday = 2 }; // one can assign any value to enum constants
int foo = monday; // the enum type is not necessary.
In Java the following construct is used to create constants:
interface Date {
public static final String MONDAY = "MONDAY";
}
String someDay = Date.MONDAY; // uppercase is only a convention