Forums Register Login

Confused in hashcode method--

+Pie Number of slices to send: Send
According to one of wiz lab example

Even the state of object does not change, it is perfectly legal that the hash code returned by it may not remain consistent from one execution of an application to another execution of an application of the same application.

as per my knowledge hash code should be always same..... completely confused have exam on monday.... highly appriciate quik responses.

Thanks
+Pie Number of slices to send: Send
hi

Yes.... the hashcode will remain same for any number of calls with in a single execution ...I hope u got confussed here only .. With that execution it will remain same ..

If that program is executed second time the hash code need not be same as what we obtained in first excution but it will remain same through out the second execution ... hope this helps ...

Prasanna
+Pie Number of slices to send: Send
Hi find the Example code for this ...

See the hashcode value i got may be different from what u get ..but the if condition will always remain true..

Prasanna
Shiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 550 times.
Similar Threads
hashCode() on diferent applications
hashCode.... help
equal() method of class Object
question concering hashCode(), equals() and operator ==
HashCode and Equals Contract Question from Inquisition Exam
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:11:37.