Mine
public text v1 · immutableclass Message {
public String contents;
}
class Box {
private Message m;
private int p;
public Box() {p=10;}
public synchronized void one(Message x) {
while (p<10) wait();
m.contents=x.contents; p=0;
}
public synchronized void two(Message x) {
x.contents=m.contents; p=p+1;
if (p==10) notifyAll();
}
}