Which method of Deque is used to insert an element at the beginning and throws an exception if the deque is full?

  1. addFirst()
  2. offerFirst()
  3. putFirst()
  4. push()
Correct answer addFirst()

Explanation

addFirst() throws IllegalStateException if the deque is full.

Update: Admin added a tag on this question

Topics

By Admin · · 28 views