When we try to print any object using toString() we get the HashCode (if toString() is not overriden). But, If I want to print the Hashcode of the String Variable, what should I do.
This question it is with respect to Java.
When we try to print any object using toString() we get the HashCode (if
Share
Just call
hashCode()on theStringobject:If you want it in the same format as
Object.toString(), try this: