I understand the part where wait(), notify(), and notifyall() are to be called. What i dont understand is the output that the below code produces. Its from
Java 9th reference.
Below is the output
I understand till the part when put is called, and wait() executes in put,
thread is stopped, get is called and then wait() executes again inside get method . What i don't understand is why does the polling is carried out till the values are 5 and then exit? Is it based on the fact that the default value of thread-priority is 5 and must be achieved by each thread before it exits?