Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

equals vs hashCode (K&B Exam 6)

 
Michal Burak
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K&B Exam SCJP6 quiz 1 question 52:



My code that prints "false true" is below. Hashcodes are not equal, equals returns true. But equal objects must have equal hashcodes.
So conclusion: only "C" is the correct answer ("D" is not correct opposed to what it says in the mock exam). Am I right or do I miss something?

 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right, this is an error in the mock exam. This has been asked before too

And welcome to javaranch...
 
Michal Burak
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:Yes you are right, this is an error in the mock exam. This has been asked before too

And welcome to javaranch...


Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic