As well as using the techniques above which add a field to the enumerated type you can also use a pure method based approach and polymorphism. This is more "OOP style" but I would not say it is necessarily better.
Unfortunately, you may (see the comment below) need to define an interface:
public interface AnimalTraits {
default boolean isAmphibian() { return false; };
default boolean isReptile() { return false; };
default boolean isMammal() { return false; };
}
But then you can them implement the interface in each of your enumeration elements:
public enum Animal implements AnimalTraits {
ELEPHANT { @Override public boolean isMammal() { return true; } },
GIRAFFE { @Override public boolean isMammal() { return true; } },
TURTLE { @Override public boolean isReptile() { return true; } },
SNAKE { @Override public boolean isReptile() { return true; } },
FROG { @Override public boolean isAmphibian() { return true; } }
}
Note that I use default implementations in the interface to cut down on the amount of typing you need in the enum.
Regarding the necessity of the interface: I tried adding the methods in the interface as abstract methods at the top of the enum and Eclipse seemed to allow it and insisted on implementations in the enum elements, but then failed to compile those properly. So it looks like it ought to be possible without an interface, but perhaps it is not yet implemented in the compiler.