I have declared a Queue of objects Node with the following lines of code:
Queue<Node> queue;
queue = new LinkedList<Node>();
However, when I declare a stack of the Node objects, by replacing the Queue with stack, it doesn't work. Why is it so? Also, what exactly does
queue = new LinkedList<Node>();
mean? Does it mean that a linked list of Node objects is being created and can be in the Queue?
I am taking open courseware to learn about Data Structures and Algorithms and I am a beginner. Thanks!