title: Equals operator for zeros (BigDecimal / Double) in Java
body: <p>A few interesting observations w.r.t equals operator on 0 and 0.0</p>
  
  <ol>
  <li><p><code>new Double(0.0).equals(0)</code> returns false, while <code>new Double(0.0).equals(0.0)</code> returns true.</p></li>
  <li><p><code>BigDecimal.ZERO.equals(BigDecimal.valueOf(0.0))</code> returns false, while <code>BigDecimal.ZERO.equals(BigDecimal.valueOf(0))</code> returns true.</p></li>
  </ol>
  
  <p>Looks like the string comparison is being done in both the cases. Could anyone throw some light on this.</p>
  
  <p>Thanks.</p>