Geekific

What will be the output of the following code?
--------------------
public static void main(String[] args) {
Deque<Integer> deque = new LinkedList<>();
deque.push(1);
deque.push(2);
deque.push(3);
System.out.print(deque.pop() + " ");
System.out.print(deque.pop() + " ");
System.out.print(deque.pop());
}

4 days ago | [YT] | 10



@CST1992

Doesn't this violate the FIFO nature of a queue? What you are showing here is LIFO. A stack.

4 days ago (edited) | 1