summaryrefslogtreecommitdiff
path: root/Year_3/TSDWL/ex_20131219/Shared.java
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-12-01 23:48:05 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-12-01 23:48:05 +0100
commit4bcd3b16da0eb0f0efe4fb5eb1e8c6bea9e79cf2 (patch)
tree6807da54f1f8b7a3f6f669e412adb20e9c9e2a58 /Year_3/TSDWL/ex_20131219/Shared.java
parent26d58225f0cb3256bf1c715257d2882271f3ecae (diff)
tsdwl: adds in java
Diffstat (limited to 'Year_3/TSDWL/ex_20131219/Shared.java')
-rw-r--r--Year_3/TSDWL/ex_20131219/Shared.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/Year_3/TSDWL/ex_20131219/Shared.java b/Year_3/TSDWL/ex_20131219/Shared.java
new file mode 100644
index 0000000..18976c5
--- /dev/null
+++ b/Year_3/TSDWL/ex_20131219/Shared.java
@@ -0,0 +1,10 @@
+public class Shared {
+ private int m;
+
+ public Shared() {
+ m = (int) (Math.random() * (11-1+1)+1);
+ }
+
+ synchronized public void set(int val) { m = val; }
+ synchronized public int get() { return m; }
+}