I am practicing with stacks and queues and have some questions about them (mostly on queues)
How would I implement a queue in my code?
package *****;
import java.util.*;
public class stackPractice {
/**
* @param args
*/
public static void main(String[] args) {
Stack st = new Stack();
Queue q = new Queue();
st.push(100);
st.push(90);
st.push(70);
System.out.println(st);
//st.pop();
System.out.println(st.pop());
System.out.println(st);
System.out.println(st.peek());
//value = st.peek();
}
}
I got Stack st to work as a stack, but Queue is giving me problems
on the 2nd Queue after new, there is a red squiggly line that says "Cannot instantiate the type Queue".
Queue q = new *Queue*();
I am not sure what that means.
---edit---
I know there is no actual code for the queue to do anything yet (enqueue, dequeue, etc...).