1) Enum is type-safe you can not assign anything else other than predefined enum constant to an enum variable.
2) Enum has its own name-space.
3) Best feature of Enum is you can use Enum in Java inside Switch statement like int or char primitive data type.
4) Adding new constants on Enum in Java is easy and you can add new constants without breaking existing code.
No comments:
Post a Comment