The only way to add values to a enum is to recompile the application . Even then, the application must have code to handle those enums.
Read moreCan enum have static variables?
Enum is a public and static class . And only static and public variables are can call inside the main method.
Read moreCan enum have attributes?
An enum can, just like a class , have attributes and methods . The only difference is that enum constants are public , static and final (unchangeable – cannot be overridden). An enum cannot be used to create objects, and it cannot extend other classes (but it can implement interfaces).
Read moreHow do I create an enum variable?
If you just use #define to define constants used as values for some variable the debugger will show you the numer. With enum it can show you the names. And if you need a set of possible values (constants) for a single variable you can define it the way you showed.23 Mar 2010
Read moreShould enums be string or int?
Therefore, go for the meaning : the Strings are more meaningful than numbers, so use the String . Show activity on this post. Both have advantages. If you store them by their Integer value, then you must be careful editing your enumeration later on in your project.
Read moreCan enum values be strings?
Every enum has both a name() and a valueOf(String) method . The former returns the string name of the enum, and the latter gives the enum value whose name is the string.
Read moreCan I store string in enum?
Enum constants can only be of ordinal types ( int by default), so you can’t have string constants in enums .
Read more