Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt with generics

 
Chandra Sekar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See previous discussion here. Just replace

with
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic