/* * This class creates two dice and rolls both of them. * We then explicitly set both dice to 6. */ public class RollingDice{ public static void main(String[] args){ Die die1 = new Die(); Die die2 = new Die(); int faceValue1 = die1.roll(); int faceValue2 = die2.roll(); System.out.println("You rolled a " + faceValue1 + " and a " + faceValue2); System.out.println("The sum is " + (faceValue1 + faceValue2)); // Explicitly set both die to 6 die1.setFaceValue(6); die2.setFaceValue(6); // Let's make sure that worked... int check1 = die1.getFaceValue(); int check2 = die2.getFaceValue(); System.out.println("\nThese should both be 6:"); System.out.println(check1 + " " + check2); } }