title: Difference between add() and offer() methods of Queue interface
body: <p>I was going though FIFO implementation in Java and came across this java.util.Queue interface. Dequeue implements it which in turn is implemented by Linked List.</p>
  
  <p>I wrote the following code </p>
  
  <pre><code>public class FIFOTest {
  
      public static void main(String args[]){
  
          Queue&lt;String&gt; myQueue = new LinkedList&lt;String&gt;();
          myQueue.add("US");
          myQueue.offer("Canada");
  
          for(String element : myQueue){
              System.out.println("Element : " + element);
          }
      }
  
  }
  </code></pre>
  
  <p>Both seem to do the same thing. Add data to the head of the queue. What is the difference between these two methods? Any special cases in which either would be more beneficial than other?</p>