Question: The producer-consumer code for storing in a single integer was explained in class. Now, that code would be extended to be used for an array
The producer-consumer code for storing in a single integer was explained in class. Now, that code would be extended to be used for an array of integers where the producer or consumer will add or consume from one end of the array only, that means items will be added at last of the array and consumed from last of the array as well. The code extended the class Q . Now write the full java code using synchronisation get() , put( int n ) & main method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
