In Java Enum is a special kind of datatype
, by looking at the word datatype I got few questions like does it have predefined memory size in memory or Are the elements in Enum
set to any data structure
like Queue
for fast access.
As per Java doc
The enum declaration defines a class (called an enum type). The enum class body
can include methods and other fields. The compiler automatically adds some special
methods when it creates an enum
.
Why the compiler adds special methods to enum. Could anybody shed light on this?
Thanks in advance?