File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
Programmer Certification (SCJP/OCPJP)
Error K&B book
Joined: Jan 10, 2007
Feb 20, 2007 13:55:00
K&B pg 610, fourth bullet states that the generic class List<? extends Dog> can be accessed but not modified.
The code shows that this incorrect.
public static void main(
List<String> Sla = new
List<? extends String> Dog = new
Dog = Sla;
for (String d: Dog)
Joined: Aug 03, 2002
Feb 20, 2007 14:03:00
You may remember that you posted this
Adding null is allowed but is rather pointless.
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Error K&B book
Generics adding to List (? extends Object)
Type of the Generic List
How Does the Compiler Know Not To Allow Adding to a Generic List With a Wildcard?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014