I am not able to understand enum
when i encountered Enum<Type>
.Generally, we use enums as a separate class or as a class member.
a)What are the reasons and benefits of declaring an enum as a separate class or as a class member ? Can anyone explain ?
b)When would one extend Enum<Type>
instead of using enum
? What are the benefits of extending Enum<Type>
.
I happened to bump into the question which addresses valueOf()
method in enum
and Enum<Type>
but that is very generic.
I went through the Oracle documentation but that doesn't explain the power of enums, atleast i didn't find the information i was looking for.
If someone can point me to an example or documentation which explains enums at the grass root level ,it would be great.
EDIT: Made questions more clearer. Changed the topic to be more relevant.