This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B Chapter 7 Question # 12 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "K&B Chapter 7 Question # 12" Watch "K&B Chapter 7 Question # 12" New topic
Author

K&B Chapter 7 Question # 12

Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
I have fixed the code as suggested by the question and implemented the equals method as follows



Even now I am getting 5 as the answer. Please tell me what is wrong


Paras Jain
SCJP 5.0
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
I got this corrected by implementing hashCode() method. I have referred to one of the questions asked earlier in the forum.
 
Consider Paul's rocket mass heater.
 
subject: K&B Chapter 7 Question # 12