您的位置:首页 > 编程语言 > Java开发

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

2013-01-16 21:35 465 查看
(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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: