diff options
Diffstat (limited to 'Java/coin.java')
-rw-r--r-- | Java/coin.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Java/coin.java b/Java/coin.java new file mode 100644 index 0000000..4765812 --- /dev/null +++ b/Java/coin.java @@ -0,0 +1,28 @@ +import java.util.Random; + +public class coin{ + + private boolean status; + +public coin(){ + Random random = new Random(); +if (random.nextInt() % 2 == 1){ + status = true; +} else { + status = false; +} + +} + +public String toString(){ + if(status){ +return "coin is heads"; + } else { +return "coin is tails"; + } +} + +} + + + |