✅ The correct answer is:
DequeextendsQueue
Why?
Queueis more general — it defines FIFO behavior.Deque(Double Ended Queue) is more specific, allowing insertion/removal at both ends, so it extends the basicQueuecontract.
📚 From the Java hierarchy:
public interface Collection<E> { ... }
public interface Queue<E> extends Collection<E> { ... }
public interface Deque<E> extends Queue<E> { ... }
So the hierarchy is:
Collection
↑
Queue
↑
Deque
This makes sense semantically too — every Deque is a Queue, but not every Queue is a Deque.