aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes KB book selftest (question on Generics and Collections ) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "KB book selftest (question on Generics and Collections )" Watch "KB book selftest (question on Generics and Collections )" New topic
Author

KB book selftest (question on Generics and Collections )

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634





Kb book
self test
pg-649
question-4







Which is correct? (Choose all that apply.)
A. As the code stands it will not compile
B. As the code stands the output will be 2
C. As the code stands the output will be 3
D. If the hashCode() method is uncommented the output will be 2
E. If the hashCode() method is uncommented the output will be 3
F. If the hashCode() method is uncommented the code will not compile



ans is :C ANd D
i think answer should be C and E

hasCode() determines the bucket,so all object would be placed in the same bucket.
Map can hold duplicate entries
and as far i know equals is used so that when we use the
get function to retrieve the data ,the passed object is same as which we
used in the


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

This question is already discussed. Check it here


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: KB book selftest (question on Generics and Collections )