title: Java boolean null cast
body: <p>I have the following code snippet:</p>
  
  <pre><code>Boolean var=false;
  boolean var1=(var=null);
  
  if(var1){
     //it compiles
  }
  if(var=null){
     //it compiles
  }
  </code></pre>
  
  <p>Why does it compile? </p>
  
  <p>In the <code>Boolean</code> class I found the following:</p>
  
  <pre><code>public static boolean parseBoolean(String s) {
          return ((s != null) &amp;&amp; s.equalsIgnoreCase("true"));
  }
  </code></pre>
  
  <p>Does it mean that is <code>null</code> considered as <code>false</code>? Why the result of <code>=</code> operation on <code>boolean</code> is <code>false</code>? What the practical reason of this behavior?</p>