Object class declares an equals() method which checks the memory address
just as == operator. now, if in the class u have created, u don't
override euqals() method then the Object class version is called,
which compares the addresses.the hashcode() method in the Object class
returns the "class name"+@+hexadecimal representation of object.
this is unique to each object.hence, if u don't override the hashcode()
method in ur class and use the default version of the Object class,
then it would return same values only for references pointing to the
same object.
"Boolean equals(Object o):Just does the contents' comparison .. "
equals methods implementation is in ur hands.though the content comparison
that u r stating above is for the
String and StringBuffer classes.
also remember one more thing :
Float f=new Float("2f");
Integer i=new Integer("2");
i.equals(f) would return false because the equals() method in wrapper
classes are overridden so as to check the class also.
correct me if i am wrong.