Hi,
I have an enum, which looks like
public enum Animal {
ELEPHANT,
GIRAFFE,
TURTLE,
SNAKE,
FROG
}
and I want to do something like
Animal frog = Animal.FROG;
Animal snake = Animal.SNAKE;
boolean isFrogAmphibian = frog.isAmphibian(); //true
boolean isSnakeAmphibian = snake.isAmphibian(); //false
boolean isFrogReptile = frog.isReptile(); //false
boolean isSnakeReptile = snake.isReptile(); //true
boolean isFrogMammal = frog.isMammal(); //false
boolean isSnakeMammal = snake.isMammal(); //false
I simplified the example for didactic purposes, but this would be really useful to me for my real life example. Can I do it in Java?