Which method is preferred over `add()` to avoid exceptions when inserting?

  1. put()
  2. offer()
  3. enqueue()
  4. insert()
Correct answer offer()

Explanation

`offer()` returns false instead of throwing an exception if the queue is full.

Update: Admin added a tag on this question

Topics

By Admin · · 25 views