(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 useful as String is final, so it can have no subclasses).
即包括String的子类,而String没有子类,为null。
本文解析了泛型上界和下界的含义,通过示例解释了<? super String>和<? extends String>的区别。前者允许String及其父类(即Object),后者则指String及其可能的子类(尽管String为final类,实际上并无子类)。
1331

被折叠的 条评论
为什么被折叠?



