Back to notes -- Keyboard shortcut: 'u'              Lecture 14 - slide 35 : 41
Program 3
 

class CubbyHole {
    private int contents;

    public synchronized int get() {
        System.out.println("Consumer got: " + contents);
        return contents;
    }

    public synchronized void put(int value) {
        contents = value;
        System.out.println("Producer put: " + value);
    }
} // end CubbyHole