作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个类(class) Foo<T>
.怎么说我要T
成为实现 BarInterface
的某个类?简单写class Foo<T implements BarInterface>
不编译。
最佳答案
使用 extends
而不是 implements
。
关于java - 如何限制泛型类中允许为 "T"的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3288053/
我是一名优秀的程序员,十分优秀!