title: Why does this cause a ClassCastException?
body: <pre><code>public class Test8 {
     public static void main (String args[]) {
        Number numberRef = new Integer(0);
        Double doubleRef = (Double)numberRef;
     }
  }
  </code></pre>
  
  <p>It shows me exception at runtime:</p>
  
  <pre>
  Exception in thread "main" java.lang.ClassCastException:
    java.lang.Integer cannot be cast to java.lang.Double
  </pre>
  
  <p>Why is it so?</p>