0
What is enums
3 Answers
+ 5
Enums are lists of constants. When you need a predefined list of values which do not represent some kind of numeric or textual data, you should use an enum. You should always use enums when a variable (especially a method parameter) can only take one out of a small set of possible values.
+ 1
They're actually a really useful way of making your code more readable. For example, if I was using hex codes for basic colors, I could just make enums for them. That way I could just say BLACK instead of #000000 or WHITE instead of #FFFFFF.
+ 1
Enums are the set of constants...which can ve acess through switch case statment.
Ex:days={sunday,monday,tuesday........,saturday}
This....constant values has the constant set called "days"
THIS IS KNOWN AS ENUMS