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 Doubt with generics 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 "Doubt with generics" Watch "Doubt with generics" New topic

Doubt with generics

Chandra Sekar
Ranch Hand

Joined: Apr 12, 2006
Posts: 94
In the K&B book, Chapter-7, Page 634, Q-16, the method declaration is given as below,

public static <E extends Number> List<? super E> process(List<E> nums)

For the above decalaration, none of the given option should compile. The right option would have been,

ArrayList<Integer> input = null;
List<? super Integer> output = null;

Am I right

Deepak Bala

Joined: Feb 24, 2006
Posts: 6661

Yup ! i was thinking of mailing Bert on that one. I tried it with a compiler just to be sure. If something is fishy about that answer , other ranchers , please let us know.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
See previous discussion here. Just replace


"I'm not back." - Bill Harding, Twister
Edisandro Bessa
Ranch Hand

Joined: Jan 19, 2006
Posts: 584
Hi Jim,

I've just seen your post in JavaRanch Temporary Errata about this question.

If you check the Temporary Errata thread for the first Bert's post, he had already post such issue.

"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
subject: Doubt with generics
Similar Threads
Generic doubt
Generics Question
SCJP Chapter 7, Question #16
Question about generics
Doubt in Generics