-2
public class TypeMessage {

    public static enum GRAPH_ERROR {
        ERROR_INPUT, ERROR_GRAPH
    }


    public enum INPUT_TYPE {
        INTEGER, DOUBLE
    }
}

First enum is static, second is not static. I use TypeMessage.GRAPH_ERROR and TypeMessage.INPUT_TYPE.

Q: Does the fact that I wrote the word static in this situation has no effect?

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Dmytro Ivanov
  • 1,260
  • 1
  • 8
  • 10

2 Answers2

2

From Java Language Specification 8.9:

A nested enum type is implicitly static.

so there is no difference between them.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
1

For enums it doesn't matter. You can access both enums in the same way: TypeMessage.GAPH_ERROR and Typemessage.INPUT_TYPE.

Sergii Lagutin
  • 10,561
  • 1
  • 34
  • 43