I have to use a switch to get the values of a enum. The enum is this one:
public enum Compass { NORTH, SOUTH, EAST, WEST; }
And I did this (in another Class outside the enum):
Compass.values()[0].name()
But the book says that the way to do it is:
Compass[] comp = { Compass.NORTH, Compass. SOUTH, Compass.EAST, Compass.WEST }
comp[0].name();
Is any of them better than the other? I mean, is more stable creating a Enum "object" or something?