Question: public class Q { int n[]; int size; int content; synchronized int get() { while(isEmpty()) try { wait(); }catch(InterruptedException e) { System.out.println(InterruptedException caught); } Q(int

 public class Q { int n[]; int size; int content; synchronized

public class Q { int n[]; int size; int content; synchronized int get() { while(isEmpty()) try { wait(); }catch(InterruptedException e) { System.out.println("InterruptedException caught"); } Q(int size) { n= new int[size]; this.size = size; content = -1; = System.out.println("Got("+content+");"+n[content]); content--; notify(); return n[content+1]; } // end of get boolean isFull() { return content==(size-1); } Il you have to write the code for put() method boolean isEmpty() { return content } -1; } // end of class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!