title: No Exception while type casting with a null in java
body: <pre><code>String x = (String) null;
  </code></pre>
  
  <p>Why there is no exception in this statement?</p>
  
  <pre><code>String x = null;
  System.out.println(x);
  </code></pre>
  
  <p>It prints <code>null</code>. But <code>.toString()</code> method should throw a null pointer exception.</p>