[code="java"]public class MainTest {
public static void main(String[] args){
List<Integer> a = (List<Integer>)func();
System.out.println(a);
}
public static List func(){
List<String> ret = new ArrayList<String>();
ret.add("hello");
return ret;
}
}[/code]
最后竟然能输出[hello]
为什么不会提示报错呢?是不是如上的类型转换只会检查最外层的类型List?