[英]Usage of Comparable Interface with generic static method in Java
How to use Comparable interface with generic static method? 如何将Comparable接口与通用静态方法一起使用?
Suppose lets say I have: 假设我有:
**public static <T extends Comparable<T>>int larger(T[] array,T element)**
Why should I extend an Interface with T here instead of using implements? 为什么在这里用T扩展接口而不是使用工具?
Please Help me out.Thanks. 请帮帮我。谢谢。
据Java泛型,你应该使用extends
连接口,还有如没有这样的事情impelements
在界类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.