FileDocCategorySizeDatePackage
Die.javaAPI DocExample678Sun Mar 28 19:07:56 BST 1999None

Die

public class Die extends Object implements Serializable

Fields Summary
private int
face
Random
shooter
Constructors Summary
public Die(int face)


     
    this.face = (int) (Math.abs(face % 6) + 1);
  
Methods Summary
public intgetFace()

    return this.face;
  
public static voidmain(java.lang.String[] args)


    Die d = new Die(2);
    for (int i = 0; i < 10; i++) {
      d.roll();
      System.out.println(d.getFace());
    }

  
public introll()

    this.face = (int) ((Math.abs(shooter.nextInt()) % 6) + 1);
    return this.face;
  
public voidsetFace(int face)

    this.face = (int) (Math.abs(face % 6) + 1);