linked list queue headaches
I'm trying to set up a queue implemented by a linked list. I don't understand how to access the private linked list methods. I've tried setting up another instance of a class of the queue called "set" and then calling the methods by set.queue.whatevermethod and it's not working ....help
import java.util.LinkedList;
publicclass AQueue3{
private LinkedList queue =new LinkedList();
publicvoid enqueue(Object s){
// Add an item to end of queue.
queue.addLast(s);//add what goes here
}
public Object dequeue(){
//remove an item from the front
return queue.removeFirst();//add what goes here
}
publicboolean isEmpty(){
// Test if the queue is empty.
return queue.isEmpty();
}
AQueue3 set =new AQueue3();
publicstaticvoid main(String[] args){
set.queue.enqueue("It's about time you got this taken care of!");
queue.enqueue("Zagaton!");
queue.enqueue("Care Bear.");
queue.dequeue();
queue.dequeue();
queue.enqueue("This is another attempt at the impossible.");
}
}// end class Queue
Any help is appreciated...dansing

