Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help running this code. I keep getting errors showing *missing classes* issues and cannot find symbol. These are the Java codes: import java.util.Date;

I need help running this code. I keep getting errors showing *missing classes* issues and cannot find symbol. These are the Java codes:

import java.util.Date; public class Factory { public static void main(String args[]) { // creates the message queue

Channel queue = new MessageQueue();

// Creates the producer and consumer threads and pass

Thread producer = new Thread(new Producer(queue)); Thread consumer = new Thread(new Consumer(queue)); // start the threads producer.start(); consumer.start(); } }

import java.util.Date;

class Producer implements Runnable { private Channel queue;

public Producer(Channel queue) { this.queue = queue; } public void run() { Date message;

while (true) { // nap for awhile SleepUtilities.nap(); // produces an item and enter it into the buffer message = new Date(); System.out.println("Producer produced " + message); queue.send(message); } } }

import java.util.Date;

class Consumer implements Runnable { private Channel queue; public Consumer(Channel queue) { this.queue = queue; } public void run() { Date message; while (true) { // nap for awhile SleepUtilities.nap(); // consumes an item from the buffer message = queue.receive(); if (message != null) System.out.println("Consumer consumed " + message); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions