equals and hascode

hi allcan anyone explain me the use of equals and hascode ?thanksdarshan
[100 byte] By [darshangajjara] at [2007-10-3 2:49:03]
# 1

I am not an expert on hashcode but basically the equals method is the java way of testing objects for equality.

The default equality implementation is done by testing equality of references.

A Class may override the equals method to provide the tests based on the content of the object.

Ex:- java.lang.String

When you are creating new classes you should also implement your own equals method if nessasary but in most of the cases the reference based equality is sufficient.

LRMKa at 2007-7-14 20:37:49 > top of Java-index,Java Essentials,Java Programming...
# 2

> can anyone explain me the use of equals and hascode ?

Instead of us repeating what has been stated in the forum previously, why don't you try searching the forum first before posting a question?

Its really not that hard!!! I just used "equals and hashcode", taken directly from your subject and found severaly postings on the subject.

camickra at 2007-7-14 20:37:49 > top of Java-index,Java Essentials,Java Programming...