0

What is enums

7th Sep 2017, 6:00 PM
C Promzzy Chima
C Promzzy Chima - avatar
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.
7th Sep 2017, 6:31 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 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.
8th Sep 2017, 4:49 AM
Sean Douglas
Sean Douglas - avatar
+ 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
26th Oct 2019, 5:08 AM
Mohamed Fayaz
Mohamed Fayaz - avatar