summaryrefslogtreecommitdiff
path: root/Year_3/TSDWL/ex_20191218/Shared.java
blob: 105fbf8d408b962716abbe328dd56937bd01891e (plain)
1
2
3
4
5
6
7
8
9
10
public class Shared {
    private int x;

    public Shared() {
        x = (int) (Math.random() * (10-0+1)+0);
    }

    synchronized void set(int val) { x = val; }
    synchronized int get() { return x; }
}