title: Java Generics for Upper bound & lower bound wild cards
body: <p>I was reading java generics, I came across an interesting query. My question is as follows.</p>
  
  <ol>
  <li><p>For an upper bounded wildcard</p>
  
  <pre><code>public static void printList(List&lt;? extends Number&gt; list) {
      for (int i = 0; i &lt; 10; i++) {
          list.add(i);// gives compilation error
      }
  }
  </code></pre></li>
  <li><p>For a lower bounded wildcard</p>
  
  <pre><code>public static void printList(List&lt;? super Integer&gt; list) {
      for (int i = 0; i &lt; 10; i++) {
          list.add(i);// successfully compiles
      }
  }
  </code></pre></li>
  </ol>
  
  <p>I am confused with this because looking at the Sun Oracle documentation I understand that the code should compile for point 1 as well</p>
  
  <p><a href="http://docs.oracle.com/javase/tutorial/java/generics/upperBounded.html" rel="noreferrer">Upper Bound Wildcard</a>
  <a href="http://docs.oracle.com/javase/tutorial/java/generics/lowerBounded.html" rel="noreferrer">Lower Bound Wildcard</a></p>
  
  <p>Can anyone please help me to understand this?</p>