java.lang · java.base · since Java 1.5
Enum
public abstract class Enum<E extends Enum<E>>
implements Comparable<E>, SerializableThe implicit superclass of every enum type, supplying name(), ordinal(), compareTo (declaration order), and serialization-safe singleton semantics per constant.
Key methods
String name() | The exact constant identifier — stable for persistence. |
int ordinal() | Declaration position — never persist or compute from it (EJ 35). |
static <T> T valueOf(Class<T>, String) | Name → constant; IllegalArgumentException on unknown. |