Possible Duplicate:
difference method java using enum types
Is it possible to calculate the difference between the values of 2 enum types using a static method? Where the enums represent a deck. (i.e. Two(2) of Spades, Queen(10) of Hearts = 8).
public enum Rank {TWO, THREE, FOUR, FIVE, SIX,SEVEN, EIGHT, NINE, TEN,
JACK, QUEEN, KING, ACE}
public enum Suit {CLUBS, DIAMONDS, HEARTS, SPADES}
I want the method to return the difference in ranks between two cards…
Not sure how to approach/efficiently implement this. Thanks
1 Answer