Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these methods does BlockingQueue declare for the blocking forms of insert and remove?

  • A.push and pop
  • B.put and take
  • C.add and remove
  • D.offer and poll

Answer: B

put and take are the forms that wait for space or for an element. add and remove throw when they cannot proceed, and offer and poll return a value or null instead of waiting. All three pairs exist, which is why the names matter.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.