java泛型中<? super String>和<? extends String> 的区别

来源:互联网 发布:运行 Windows 编辑:程序博客网 时间:2024/05/17 03:43

(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。

0 0
原创粉丝点击