title: cast List to ArrayList
body: <p>When I want to cast the <code>ArrayList</code> object in <code>List</code> reference that returned from the method: </p>
  
  <pre><code>public static &lt;T&gt; List&lt;T&gt; asList(T... a) {
      return new ArrayList&lt;&gt;(a);
  }
  </code></pre>
  
  <p>The return type from the method <code>asList</code> is a <code>List</code> reference to <code>ArrayList</code> object, which means I can cast it to <code>ArrayList</code> reference.
  Such that :</p>
  
  <pre><code>String[] colors = { "black", "blue", "yellow" };
  ArrayList&lt;String&gt; links = (ArrayList&lt;String&gt;) Arrays.asList(colors) ;
  </code></pre>
  
  <p>But this code made run-time error :</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException:
    java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList</p>
  </blockquote>
  
  <p>Why it's happened?</p>