Quiz 17 (Exercise from Big Java for Chap. 21: (Threads)
Implement a Queue class whose add and remove
methods are synchronized.
Supply one thread, called the producer,
which keeps inserting strings into the queue as long as there are fewer
than 10 elements in it.
When the queue gets too full, the thread waits.
Supply a second thread, called the consumer, that keeps removing
and printing strings from the queue as long as the queue is not empty.
When the queue is empty, the thread waits.
Both the consumer and the producer threads should run for 1000 iterations.