/** A class to illustrate one object whose * fields are other objects. * @author Ian Barland */ class Player { /** A six-sided die, used by a Monopoly player. */ Die die1 = new Die(6); /** A twenty-sided die(!), used by the ..."creative" Monopoly player. */ Die die2 = new Die(20); /** Roll both dice, and see what they total. * @return The sum of the two newly-rolled dice. */ int roll() { return die1.roll() + die2.roll(); } public String toString() { return "[Player: " + "die1=" + die1.toString() + ", " + "die2=" + die2.toString() + "]"; } }