SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Raju Champaklal wrote:if the hashcodes are same its not neccasary that both the objects are equals..they maybe be equals they may not be depending the way you have declared your equals method
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Sage of The Monstrous Toad of Mount Myoboku
rohan yadav wrote:Hi Minhaj,
First remember that if two objects hascode() method is equal, it doesn't necessarily mean that the two objects are equal.
Here a.hashCode()==b.hashCode() means you have a and b two objects are in same bucket not they are equal.
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Minhaj kaimkhani wrote:
rohan yadav wrote:Hi Minhaj,
First remember that if two objects hascode() method is equal, it doesn't necessarily mean that the two objects are equal.
Here a.hashCode()==b.hashCode() means you have a and b two objects are in same bucket not they are equal.
Hi Rohan,
well if two objects hashCode() methos is equal - means the content of both object are EQUAL!
and what is the purpose of equals() method? that the content should be same! right?
if(a.equals(b) == true then its not mandatory
a == b
means the content could be same but object's memory reference could be different!!![]()
Sage of The Monstrous Toad of Mount Myoboku
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Given two objects a and b of the same class, and if equals() and hashCode() are implemented correctly for that class, which of the following must hold true?
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Sage of The Monstrous Toad of Mount Myoboku
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Raju Champaklal wrote:what do you think the examiner mean exactly...maybe we can discuss the possibilities
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Raju Champaklal wrote:how can this be the right implementation of equals method when you are not using it in the right way and returingn true everytime....you arent even comparing the variables of different objects...you are not comparing anything....how can you call it right implementation?
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Raju Champaklal wrote:dude i am sorry i lose....you won...congrats....i cant take it anymore..any questions of hashocde and equals cming in exam would be left by me
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
SCJP 1.6 96%
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
|