public static void wildCard2(List<? super Base> lst){
for (int i=0; i<2; i++){
System.out.println(lst.get(i));
}
lst.add(new Base());
}
As shown in the code above, I have a class called Base.
Can anyone explain why this fails at RunTime and throws UnsupportedOperationException
?