了解通用超类型

时间:2019-03-19 09:14:07

标签: java generics supertype

此代码无法编译吗?
是OCP的书。

List<? super IOException> list = new ArrayList<Exception>();
    list.add(new Exception()); // does not compile 
    list.add(new IOException());
    list.add(new FileNotFoundException());

0 个答案:

没有答案
相关问题