I'm trying to create a private static final variable inside of an enum, but I keep getting a compile error. Does anyone know how to fix this?

Multiple markers at this line

  • Syntax error, insert "Identifier" to complete EnumConstantHeaderName
  • Syntax error, insert "}" to complete EnumBody
class Foo {
  ...

  public enum MyEnum {
    private static final String MY_STRING = "a string I use in a constructor";
    private static final String MY_OTHER_STRING = "a string I use in another constructor";      

    MyEnumType(1, MY_STRING),
    MyEnumType2(2, MY_STRING),
    MyEnumType3(3, MY_OTHER_STRING);

    MyEnum(int num, String str) {
      ...
    } 
  }
 ...
}
Edit
Report