Hi
This is kind of taken from
http://www.javabeat.net/javabeat/scjp5/mocks/Generics-part3-10questions.php I am not able to understand why Sun Engineers have problem with following class . I get compile error.
class GenTest<T super Number> {
T num;
public T checkNumber(T n) {
return n;
}
}
Where as the following class does not give compile error.
class GenTest<T extends Number> {
T num;
public T checkNumber(T n) {
return n;
}
}
With wild card ? both super and extends work . However with generic classes super seem to give compile error.
Can anybody provide some explanation ?
[ October 09, 2007: Message edited by: Akhil Maharaj ]