package Test2016; import java.util.ArrayList; import java.util.List; public class Test2016 { public static void main(String[] args) { List<? super Fruit> first = new ArrayList<Fruit>(); //Fruit -> Apple first.add(new Apple()); first.add(new…
<? super T>表示包括T在内的任何T的父类,<? extends T>表示包括T在内的任何T的子类;请记住PECS原则:生产者(Producer)使用extends,消费者(Consumer)使用super.原文地址:http://mp.weixin.qq.com/s?__biz=MjM5MTM0NjQ2MQ==&mid=400507472&idx=1&sn=446bdb30c96798bb177cc2e1941008a1&scene=23&…
(1)<? super String> is any class which is a superclass of String (including String itself). (In this case, the only other suitable class is Object.) 即包括String的父类和它本身的类. (2) <? extends String> (which in this specific case wouldn't be very usefu…