An enum is a special “class” that represents a group of constants (unchangeable variables, like final variables).
Source Code
enum Level {
LOW,
MEDIUM,
HIGH
}
Level myVar = Level.MEDIUM;
System.out.println(myVar);
Use enum types when you have a fixed set of constants, improving type safety and code readability.