Is there a specific rule on how Overriding equals() & hashCode() in sub classes considering super fields ?? k
Generally speaking implementing equals across subclasses is hard to keep symmetric and transitive.
Consider a superclass that checks for field x and y, and subclass checks for x, y and z.
So a Subclass == Superclass == Subclass where z is different between the first instance of Subclass and the second, violating the transitive part of the contract.
This why the typical implementation of equals will check for getClass() != obj.getClass() instead of doing an instanceof. In the above example, if SubClass or Superclass does an instanceof check it would break symmetry.
So the upshot is that a subclass can certainly take into account super.equals() but should also do its own getClass() check to avoid the above issues and then check for equals on its own fields in addition. It would be a strange duck of a class that changed its own equals behavior based on specific fields of the superclass rather than just if the superclass returns equals.