title: List<? extends Object> what I can store into it?
body: <p>I'm new to java and I have the code like this:</p>
  
  <pre><code>List&lt;? extends Object&gt; k = new ArrayList&lt;Integer&gt;();
  k.add(new Integer(1));
  </code></pre>
  
  <p>I'm getting the error like:</p>
  
  <pre><code>Error:(13, 10) java: no suitable method found for add(java.lang.Integer)
      method java.util.Collection.add(capture#1 of ? extends java.lang.Object) is not applicable
        (argument mismatch; java.lang.Integer cannot be converted to capture#1 of ? extends java.lang.Object)
      method java.util.List.add(capture#1 of ? extends java.lang.Object) is not applicable
        (argument mismatch; java.lang.Integer cannot be converted to capture#1 of ? extends java.lang.Object)
  </code></pre>
  
  <p>I have few questions:</p>
  
  <ol>
  <li><p><code>List&lt;? extends Object&gt; k = new ArrayList&lt;Integer&gt;();</code> why in right hand side of the equation doesnt allow me to put <code>new ArrayList&lt;? extends Object&gt;()</code> ?</p></li>
  <li><p><code>&lt;? extends Object&gt;</code> means any class extend <code>Object</code> right? So in java all class does extend <code>Object</code>, so why I'm getting error in line:</p></li>
  </ol>
  
  <p><code>k.add(new Integer(1));</code> </p>
  
  <ol start="3">
  <li>While declaring, java allowed me to give <code>new ArrayList&lt;Integer&gt;()</code>, but allowing me to add <code>Integer</code> why?</li>
  </ol>
  
  <p>Thanks in advance.</p>