An enum can contain a method, just like any class. To see how this works, we'll declare an enum like this:
public enum Direction {
NORTH, SOUTH, EAST, WEST;
}
Let's have a method that returns the enum in the opposite direction:
public enum Direction {
NORTH, SOUTH, EAST, WEST;
...