Yes, of course both methods belongs to the Object class. but there is something which links these two methods.
toString()
When you call this method, It returns a String. (com.pradip.Test@3dd4ab05)
It consists of class name followed by an "at" sign (@) and the unsigned Hexadecimal number.
hashCode()
and when you call this method, It returns a integer. (1037347589)
When you convert this integer to hexadecimal, It is same as toString() method hexadecimal.
No comments:
Post a Comment