+ 1
In java equals() and hashcode() play important role , but how?
2 ответов
+ 2
. equals() check if two strings or any type of var is equal which in java you can't check using '==' etc
string x, y;
x = "mark" ;
y = "mark" ;
if you try printing 'x==y' it will return false
if you try printing 'x. equals(y)' it will return true
as for hashcode a google search will help here some things about hashcode:
http://eclipsesource.com/blogs/2012/09/04/the-3-things-you-should-know-about-hashcode/
+ 1
The equals() method in java is used to compare two objects.
And for hashcode in java, every class implicitly or explicitly provides a hashCode() method, which digests the data stored in an instance of the class into a single hash value (a 32-bit signed integer).