Question: how enum works internally in java?
Answer: Each enum class is compiled as a class being a subclass of java. ... Each enum constant becomes a static final constant within that class. Then, an array $VALUES is created with all of the enum constants, in order of declaration. You can disassemble the code using the command javap -p -c Ordinals (on the compiled .