title: java generic array list
body: <p>I'm playing with generic and I have a code that I can't undestand.</p>
  
  <pre><code>public static void main(String[] args) {
      ArrayList&lt;Integer&gt; list=new ArrayList&lt;Integer&gt;();
      list.add(1);
  
      System.out.println(list);
      t(list);
      System.out.println(list);
  }
  
  static void t(List list){
      list.add("test2");
      list.add(3);
  }
  </code></pre>
  
  <p>So, it's compiled and it works. 
  I understand why the method t works .But I can realize why it is added to the main list which has stric generic type.
  Thanks</p>