枚举类型的比较

Enumeration  is actually a class. The class has exactly fixed member of instances—it is not possible to construct new objects.

Therefore, you never need to use equals for values of enumerated types. Simply use == to compare them.

You can, if you like, add constructors, methods, and fields to an enumerated type. Of course, the constructors are only invoked when the enumerated constants are constructed.

你可能感兴趣的:(枚举类型的比较)