由于使用了raw类型,编译器跳过了泛型检查!!!
也就是说,如果你使用rawtype,那么在使用泛型类型时你会失去编译时检查,这可能会将错误扩展到运行时。
public static void main(String[] args) {
List a = new ArrayList<String>(){{
add("what");
add("the");
add("f**k");
}};
List<Integer> b = a;
System.out.println(b); //[what, the, f**k]
}