Regards, Sharmila.
We will have a future if we save Nature!
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
1.If <E extends CharSequence> is same as <? extends CharSequence>, how come longWords.add(word) can be used. If collection type contains extends then you cannot use add method. Here how it is possible?
2.Why i cannot say in getLongWords() as follow?
Collection<E> longWords = new ArrayList<String>();
As String implements CharSequence, it should work fine here. But i get compile time error.
3.How come there is compile time error on line
Collection<String> resultList = getLongWords(list);
If i change the method declaration as follow ?
static public <E extends CharSequence> Collection<? extends CharSequence> getLongWords(Collection<E> coll) {
5.Please tell me which book is good for generics from the point of view of understanding and explaination?
Please help me!
SCJP 6 - 91%
<><
Regards, Sharmila.
We will have a future if we save Nature!
Regards, Sharmila.
We will have a future if we save Nature!
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Regards, Sharmila.
We will have a future if we save Nature!
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Consider Paul's rocket mass heater. |