package Exam;

class Future {
	private Object val_ = null;

	public synchronized Object value() {
		while (val_ == null) { // while vs if?
			try { wait(); }
			catch(InterruptedException err) {}
		}
		return val_;
	}
	
	public synchronized void set(Object val) {
		if (val_ == null)
			val_ = val;
		// notify();
		notifyAll(); // notify() vs notifyAll()?
	}
}
