File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generics question--Bit complicated?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics question--Bit complicated??" Watch "Generics question--Bit complicated??" New topic
Author

Generics question--Bit complicated??

prashanth kumar
Ranch Hand

Joined: Mar 22, 2004
Posts: 162
Hello All,
I have this question regarding generics.
Can anybody explain me why the options 4 and 6[i know abt this option]are correct?

Many Thanks



SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Option 4 is correct because if you removed lines 2 and 3, you are just adding a new entry to the map containing a String for key, and ArrayList for value.

Option 6 will work because there is no requirement in a general map that the keys be mutually Comparable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generics question--Bit complicated??