title: Why should I not use equals with inheritance?
body: <p>When I read a Java book, author has said that, when designing a class, it's  typically unsafe to use <code>equals()</code> with inheritance. For example:</p>
  
  <pre><code>public final class Date {
      public boolean equals(Object o) {
           // some code here
      }
  }
  </code></pre>
  
  <p>In the class above, we should put <code>final</code>, so other class cannot inherit from this. And my question is, why it is unsafe when allow another class inherit from this?</p>