This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
For instance, if two of your objects are always distinct
How the java runtime will understand that the object are distinct or how the jre will tell two user defined objects are equal?
The object class equals only check for references. Say for example for a Employee class objects may be treated equals depending on there dept and experience property not by looking at reference only.
Exactly, and this is why you would override the equals method. A lot of classes use the equals method to see when two objects are distinct or equal. You can override this method to provide your own understanding of when two objects are equal.
Keep in mind that whenever you override equals, you *must* override hashCode as well. Take a good look at the documentation for these methods.