This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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??
 
Similar Threads
map is an ArrayList, compiler knows that Object is superclass of ArrayList, yet does nothing?
Generics
Generics
generics
generics