title: Java Generics: Cannot cast List<SubClass> to List<SuperClass>?
body: <p>Just come across with this problem:</p>
  
  <pre><code>List&lt;DataNode&gt; a1 = new ArrayList&lt;DataNode&gt;();
  List&lt;Tree&gt; b1 = a1;  // compile error: incompatible type
  </code></pre>
  
  <p>Where the type DataNode is a subtype of Tree.</p>
  
  <pre><code>public class DataNode implements Tree
  </code></pre>
  
  <p>To my surprise, this works for array:</p>
  
  <pre><code>DataNode[] a2 = new DataNode[0];
  Tree[] b2 = a2;   // this is okay
  </code></pre>
  
  <p>This likes a bit strange. Can anyone give an explanation on this? </p>