Which method is used to remove the last element without exception?

  1. removeLast()
  2. pollLast()
  3. deleteLast()
  4. pop()
Correct answer pollLast()

Explanation

pollLast() removes the last element and returns null if the Deque is empty.

Update: Admin added a tag on this question

Topics

By Admin · · 38 views