Question: what is difference between poll() and remove() method of a queue?
Answer: Both poll() and remove() method is used to remove head object of the Queue. The main difference lies when the Queue is empty(). If Queue is empty then poll() method will return null . While in similar case , remove() method will throw NoSuchElementException .