Thursday, August 18, 2011

Use of Enums

When to use an Enum ?
When we have a fixed set of values which are known at compile-time.
Example would be to enumerate days of the week (cant have "funday") and to have a collection of SSN
When the elements are known up front and won't change, an enum is appropriate.
If the elements can change during runtime, use a Set.

No comments:

Post a Comment