It isn't when you think of it this way. The statement DOG("woof") when you define the enum Animals is actually calling the constructor Animals(
String) and hence setting the member
sound to "woof". Hence, System.out.println(a.DOG) is simply accessing this constant, calling the toString() method which returns the name of the constant.