Java enums vs constants for Strings
- by Marcus
I've switched from using constants for Strings:
public static final String OPTION_1 = "OPTION_1";
... to enums:
public enum Options {
OPTION_1;
}
With constants, you'd just refer to the constant:
String s = TheClass.OPTION_1
But with Enums, you have to specify toString():
String s = Options.OPTION_1.toString();
I don't like…