+ 1
trim() returns an String object, and n is an String constant, so their adress is not the same. Hashcode is calculated by hashcode() method, it uses values of object to make a certain hashcode. In other words, when l.equals(n), they must have the same hash code. Besides, even when l.equals(n)==false, their hashcode may be the same.
22nd Oct 2017, 12:34 AM
Stacey J. Wilburn
Stacey J. Wilburn - avatar