/** * This class illustrates two methods for comparing objects: * * 1. Using == or != which tests if the variables have the same value * Since variables of class type hold memory addresses, this is the * same as testing for memory equality. * * 2. Using an equals() method which tests if the objects have the * same state */ public class DieController { public static void main(String[] args){ Die die1 = new Die(8); // creates an 8-sided die Die die2 = new Die(8); // creates an 8-sided die // WHAT CODE SHOULD GO HERE? if(die1 == die2){ System.out.println("Yes, the die are equal according to =="); } else{ System.out.println("No, the die are not equal according to =="); } boolean areTheSame = die1.equals(die2); if(areTheSame){ System.out.println("Yes, they are the same according to equals method"); } else{ System.out.println("No, they are not the same according to equals method"); } } }