/* This class represents a coin with two sides: heads and tails */ import java.util.Random; public class coin { Random rnd; public boolean resultValue; /* This is the constructor. Note that the constructor * instantiates an object of type Random */ public coin() { /* create an instance of a random object */ rnd = new Random(); } /* This method returns a Boolean which represents the * flip of a coin. "True" indicates heads, "false" indicates * tails */ public boolean flip() { resultValue = rnd.nextBoolean(); return resultValue; } }