title: How to deal with equals when meet polymorphism in Java
body: <p>I meet a problem and I feel confused.
  Things like this:</p>
  
  <pre><code>class animal and 
  class cat extends animal
  </code></pre>
  
  <p>Now assumed I have already overridden the equals method both in animal and cat.</p>
  
  <p>See:</p>
  
  <pre><code>cat a = new cat("white","Tom")   //cat has specific property name    
  cat b = new cat("black","Jim")    
  a.equals(b)                      //return false    
  animal c = (animal)a             //animal has no name property
  </code></pre>
  
  <p><code>c.equals(a)</code> and <code>a.equals(c)</code> all return true</p>
  
  <p>this is weird, since you can not say an animal is a cat.</p>
  
  <p>And I learn that cast in Java does not change the class of the object. so  <code>c.getClass()</code> still returns cat. But something can do with this? I want a false when comparing animal with cat.</p>
  
  <p>Thanks</p>