public class Flags2 {
private boolean isReady = false;
public ______ void produce() {
isReady = true;
_______ ;
}
public ______ void consume() {
while(!isReady) {
try {
______ ;
}
catch(Exception ex) { }
}
isReady = ______ ;
}
}
Hints ::
synchronized
true
false
wait()
volatile
synchronized()
notifyAll()
synchronize
2006-08-28
21:22:14
·
4 answers
·
asked by
K Ban
2
in
Computers & Internet
➔ Programming & Design
Tiwari ji, fill the underlines with hints below.
Repetition is also allowed.
2006-08-28
21:51:42 ·
update #1
public class Flags2 extends Thread{
private boolean isReady = false;
public synchronized void produce() {
isReady = true;
notifyAll();
}
public synchronized void consume() {
while(!isReady) {
try {
wait();
}
catch(Exception ex) { }
}
isReady = false;
}
public static void main(String[] args) {
Flags2 f = new Flags2();
}
}
2006-08-28
22:21:56 ·
update #2