LearnFrenzy
Sign in Take a free test

Data Structures in Java · Data Structures in Java MCQ · Question 11

Why ArrayDeque is the recommended stack Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

Why does the JDK documentation recommend ArrayDeque over java.util.Stack for a stack?

  • A Stack cannot store objects
  • B Stack is synchronized and extends Vector, so it is slower and exposes index-based methods Correct
  • C ArrayDeque allows null elements
  • D Stack has no pop method
Correct Answer: Option B

ArrayDeque is an unsynchronized circular array (and it does not allow null elements).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links