import java.util.LinkedList; import java.util.Random; public class Producer extends Thread { private LinkedList queue; public Producer(LinkedList queue) { this.queue = queue; } @Override public void run() { Random random = new Random(); while (true) { // wait for 0-8 seconds try { Thread.sleep(random.nextInt(7) * 1000); } catch (InterruptedException e) { System.out.println("Producer interrupted while sleeping"); } String item = "Hello!"; // TODO: add item to the end of the queue and print it out } } }