summaryrefslogtreecommitdiff
path: root/Year_3/TSDWL/ex_20131219/Shared.java
blob: 18976c58178934d8cf3e605e7083db5a33a02e66 (plain)
1
2
3
4
5
6
7
8
9
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; }
}