Producer Extends Consumer Super
List<? extends Number> numbers = new ArrayList(); numbers.add(4); //报错 Number number = numbers.get(1);//成功 List<? super Number> strs = new ArrayList<>(); strs.add(123);//成功 Number o = strs.get(1);//报错
上界通配符(Upper Bounded Wildcards)
下界通配符(Lower Bounded Wildcards)