Should Java member enum types be capitalized?

If they are their own class start with upper case, if they are members lower case.

public enum ReportType { XML, TEXT, HTML };

public class MyClass
{
     ReportType defaultReport = ReportType.XML; 
}

Are you sure you are using the default settings? Because generally enums are indeed capitalized. Variables holding enum values should not start with a cap though.

public enum State {
  UNINITIALIZED,
  INITIALIZED,
  STARTED,
  ;
}

private State state;

private void start() {
  state = State.UNINITIALIZED;
  ...
}
`.

You may use static imports to get rid of the State. part as well, although generally I think it is better to leave it be. The enum values are constants and should be in CAPS. I've seen people change fields in enum constants during runtime, and that is not what you want (except for lazy instantiation within the class itself now and then).


Enums are a type and the enum name should start with a capital. Enum members are constants and their text should be all-uppercase.