Here n1 and n2 are reference variables. And n1 and n2 are referring to two different objects on the heap. So n1==n2 will be false. n1==n2 will always be false unless n1 and n2 referring to the same object on the heap.
when you say n1==n2, it wont compare the hashCode Values of the objects referred by n1 and n2 but it will check if both n1 and n2 are referring to the same object!
Hope this is clear!
Thanks,<br />Srilatha M
Joined: Oct 13, 2008
you mean there is no contract in between == and hashcode..