just wanted to ask on how to compare index of enum of two objects:
enum Face {ACE,TWO,THREE,FOUR,FIVE}
static final Face[] FACES = Face.values();
static final Random RAND = new Random();
public static Red_Dog random()
{
return new Red_Dog(SUITS[RAND.nextInt(SUITS.length)],
FACES[RAND.nextInt(FACES.length)]);
}
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Red_Dog c1 = Red_Dog.random();
Red_Dog c2 = Red_Dog.random();
while(c1.equals(c2))
{
c1 = Red_Dog.random();
c2 = Red_Dog.random();
}
System.out.println("First card: "+c1 + " Second card: " + c2);
Result: First card: FIVE Second card: TWO
I want to compare first card(c1 - 1st object) and second card(c2 - 2nd object). What methods do I need to use?