This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

equals vs hashCode (K&B Exam 6)  RSS feed

 
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: 9608
36
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
Boost this thread!