Which method removes the first element in a Deque and throws exception if empty?

  1. pollFirst()
  2. removeFirst()
  3. deleteFirst()
  4. pop()
Correct answer removeFirst()

Explanation

removeFirst() throws NoSuchElementException if the Deque is empty.

Update: Admin added a tag on this question

Topics

By Admin · · 48 views