|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDice
public class Dice
Represents a dice with a specified number of sides
Constructor Summary | |
---|---|
Dice()
Constructs a standard dice with 6 sides |
|
Dice(int numberOfSides)
Constructs a dice with a specified number of sides |
Method Summary | |
---|---|
int |
getValue()
To access the value |
static void |
main(String[] args)
A small test program |
int |
roll()
Makes a random change of the value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dice()
public Dice(int numberOfSides)
numberOfSides
- number of sides
RuntimeException
- if non positive number of sidesMethod Detail |
---|
public int roll()
public int getValue()
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |