SCJP 5
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.
<a href="http://www.dantheman.pl" target="_blank" rel="nofollow">http://www.dantheman.pl</a>
Originally posted by Daniel Charczynski:
[QB]
No it isn't.
The real reason is that Collection<? extends CharSequence> doen't fit to Collection<String>;
QB]
SCJP 5
<a href="http://www.dantheman.pl" target="_blank" rel="nofollow">http://www.dantheman.pl</a>
Originally posted by xitiz bhatia:
K&B have mentioned the method declaration as erronous in their errata at the link below--
https://coderanch.com/t/257589/java-programmer-SCJP/certification/SCJP-Errata-Updated
Now the method declaration becomes-
public static <E extends Number> List<E> process(List<E> nums)
<a href="http://www.dantheman.pl" target="_blank" rel="nofollow">http://www.dantheman.pl</a>
Originally posted by Daniel Charczynski:
For example
if you write your own class NewClass extends CharSequence ...
it couldn't fit to String
so
<? extends CharSequence> doesn't fit to <String>
SCJP 5