A

Admin • 828.70K Points
Coach

Q. Which method retrieves, but does not remove, the head of the queue and throws an exception if the queue is empty?

  • (A) element()
  • (B) peek()
  • (C) poll()
  • (D) top()

Explanation by: Admin
`element()` throws NoSuchElementException if the queue is empty.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.