The name() method is pretty much similar to toString() , except that it is declared final, so the definition of an enumeration cannot change it. This can be important, for example, when writing a structure for serializing data, where you need to rely on the fact that the enumeration name is one Java identifier that uniquely identifies a constant. There may be a few more applications, but as the manual says:
Most programmers should use the toString() method, preferring this one, since the toString method can return a more convenient name.
In general, I would say that you should use toString() when the output is intended for the human reader, and name() when it targets another process for parsing in some way.
source share