← Quiz: Queue, Deque and PriorityQueue: all 10 questions
Quiz: Queue, Deque and PriorityQueue · Question 3 of 10
Why is ArrayDeque preferred over the Stack class?
Why is ArrayDeque preferred over the Stack class?
- A.Stack cannot store objects
- B.ArrayDeque allows null elements
- C.Stack has no pop method
- D.Stack is synchronized and based on the old Vector class, so it is slower
Answer & explanation
Correct answer: Stack is synchronized and based on the old Vector class, so it is slower
The Java documentation recommends Deque implementations such as ArrayDeque for stack use.
Can you get the rest right without peeking?
Take the timed Quiz: Queue, Deque and PriorityQueue quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →