From 9d53d8857eaa1c9405894a88ca75bc4657e42f35 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 05:31:48 -0600 Subject: Inital Commit --- Java/coin.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Java/coin.java (limited to 'Java/coin.java') 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"; + } +} + +} + + + -- cgit v1.2.3