Question: what is difference between add and offer in queue?
Answer: The Queue interface specifies that add() will throw an IllegalStateException if no space is currently available (and otherwise return true ) while offer() will return false if the element couldn't be inserted due to capacity restrictions. ... The offer method inserts an element if possible, otherwise returning false.