Saturday, July 31, 2010

hashCode: MapEQ.java

Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 7, Question 4


















The output is 3. By commenting out hashCode(), equals() method has no effect. However if hashCode() is not commented out, then the output is 2 because Monday-payBills will overwrite Monday-doLaundry.

No comments:

Post a Comment