diff options
author | msglm <msglm@techchud.xyz> | 2023-01-14 05:31:48 -0600 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-01-14 05:31:48 -0600 |
commit | 9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch) | |
tree | eb1efc1d028b949dd83bb710c68be8eff58f26e7 /Java/coin.java | |
download | school-code-master.tar.gz school-code-master.tar.bz2 school-code-master.zip |
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"; + } +} + +} + + + |