SCJP 6 83%
Working on SCWCD/OCPJWCD
SCJP 5 ๑۩۞۩๑♥~~ My Life is My Creation ~~♥๑۩۞۩๑
SCJP 6 83%
Working on SCWCD/OCPJWCD
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 6 83%
Working on SCWCD/OCPJWCD
Originally posted by Milan Sutaria:
how does <? extends Animal> differ from <T extends Animal>? I think they both mean the same " any type that extends from class Animal or class Animal itself" But there are some conventions to it like you can use <T ...> for specifying for class but not <?...> Are there any other rules associated? ( you can add to ArrayList<T extends Animal> when it is an argument to a method)
Originally posted by Milan Sutaria:
Also, is the following code is right?
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Originally posted by ramesh maredu:
Hi,
List<Number> l = someMethod(new ArrayList<Number>());
above method call won't compile because, the return type of method someMethod() is List<? super Integer>,
means it can return either List of Integers or List of Super type of Integers.for example it can return List<Integer> or List<Number> or List<Object> etc in runtime.
So we can not hold result in List<Number> that is why it won't compile.
[ July 20, 2008: Message edited by: ramesh maredu ]
gen.java:16: incompatible types
found : java.util.ArrayList<capture of ? super java.lang.Integer>
required: java.util.ArrayList<java.lang.Number>
return list;
^
1 error
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 6 83%
Working on SCWCD/OCPJWCD
Originally posted by Milan Sutaria:
(... how about sun starting an exam only on type parameters & generics which includes inheritance overriding polymorphism etc concepts with generics)
Generics Tutorial EXTRA for detail study
Tech Tips at sun.com
[chk the links at the bottom of this page]
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |