Implementing an Unbounded Work Queue with synchronized block
import java.util.LinkedList; public class Main { public static void main(String[] argv) { WorkQueue queue = new WorkQueue(); int numWorkers = 2; Worker[] workers = new Worker[numWorkers]; for (int i = 0; i < workers.length; i++) { workers[i] = new Worker(queue); workers[i].start(); } for (int i = 0; i < 100; i++) { queue.addWork(i); } } } class WorkQueue { LinkedList