Multi Threading
© examsiri.com
Question : 23 of 44
Marks:
+1,
-0
Place the code elements in position so that the Flags2 class will compile and make appropriate use of the wait/notify mechanism.Note: You may reuse code elements.
Code Elements
Synchronized
true
false
wait()
volatile
synchronized()
notifyAll()
synchronize
public class Flags2 {
 private boolean isReady = false;
 public (1) Place here void produce() {
 isReady = true; (2)Place here
}
 public (3)Place here void consume() {
  while (! isReady) {
  try {
   (4)Place here
  }
  catch (Exception ex) { }
  }
  isReady = (5)Place here
 }
}Code Elements
Synchronized
true
false
wait()
volatile
synchronized()
notifyAll()
synchronize
Go to Question: