Ruben Soto wrote:Have you tried putting the enum and the test class in a different package and trying to compile the test class then? By the way, the sound instance variable is not an instance variable of the constant specific class body (I don't know what that would mean.) It is an instance variable of the enum type Animals. Let me know if this doesn't make things clear.
Th x Ruben
It compiles, with the warning static fields should be accessed in a static way (Animals.DOG, Animals.FISH). The syntax on line 9 confused me. Constant specific class bodies allow you to override the methods defined in the body of the enum declaration for a particular enum constant.
cheers Todd