Originally posted by Mohammed EL-Adawi:
Chapter 7, question 14, on page 632
read Choice (A)
<? extends CharSequence> makes it not correct because, It will return something "read only"
Is that Correct?? I can't find any other reasons.
No it isn't.
The real reason is that Collection<? extends CharSequence> doen't fit to Collection<
String>
________________________________________________________________________
------------------------------------------------------------------------
WARRNING in my opinion in question 16/page 364 is BIG BUG
answer should be G
________________________________________________________________________
------------------------------------------------------------------------
Given a method declared as:
public static <E extends Number> List<? super E> process(List<E> nums)
A programmer wants to use this method like this:
// INSERT DECLARATIONS HERE
output = process(input);
Which pairs of declarations could be placed at // INSERT DECLARATIONS HERE to allow
the code to compile? (Choose all that apply.)
A. ArrayList<Integer> input = null;
ArrayList<Integer> output = null;
B. ArrayList<Integer> input = null;
List<Integer> output = null;
C. ArrayList<Integer> input = null;
List<Number> output = null;
D. List<Number> input = null;
ArrayList<Integer> output = null;
E. List<Number> input = null;
List<Number> output = null;
F. List<Integer> input = null;
List<Integer> output = null;
G. None of the above.
[ November 14, 2006: Message edited by: Daniel Charczynski ]