An enum is a special type that represents a fixed set of constants. Without enums, you'd use plain strings or integers for values like "MONDAY" or 1, and a typo like "Mnday" would compile without complaint.
Here is how you define an enum:
public enum Day {
MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY, SUNDAY
}
You use it like any other type:
Day today = Day.FRIDAY;
if (today == Day.FRIDAY) {
System.out.println("Almost weekend");
}
The compiler catches invalid values at compile time. You can also add fields and methods to enums, making them more powerful than simple constants.