|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
In this program, only cast 3 should be rejected:
import java.util.List;
public class X<S extends Comparable<S>> {
Object foo(Comparable<Integer> c) {
return (Comparable<S>) c; // 1
}
<U extends Throwable, V extends Runnable> void foo(List<V> lv) {
List l = (List<U>) lv; // 2
}
<U extends Throwable, V extends Runnable> void foo2(List<List<V>> lv) {
List l = (List<List<U>>) lv; // 3
}
}
###@###.### 2005-05-13 15:51:12 GMT
|