title: Comparison of two null objects from two different types
body: <pre><code>public void m1(Integer f) {
      ...
  }
  
  public void m1(Float f) {
      ...
  }
  
  public void main() {
      m1(null); // error: the method m1(Integer) is ambiguous for the type Main
      m1((Integer) null); // success
  }
  </code></pre>
  
  <p>Given the above example, we can admit <em>in some ways</em> that <code>null</code> is typed. So why do the following lines print <code>true</code>? Sure <code>o1</code> and <code>o2</code> both have no value (i.e. <code>null</code>), but they aren't from the same type (<code>Integer</code> vs <code>Float</code>). I firstly thought <code>false</code> would have been printed.</p>
  
  <pre><code>Integer i = null;
  Object o1 = (Object) i;
  Float f = null;
  Object o2 = (Object) f;
  System.out.println(o1 == o2); // prints true
  
  // in short:
  System.out.println(((Object) ((Integer) null)) == ((Object) ((Float) null))); // prints true
  </code></pre>