Java 无法实现可比性
我试图通过类似的界面对我的通行证列表进行排序,但我失败了Java 无法实现可比性,java,android,extend,comparable,Java,Android,Extend,Comparable,我试图通过类似的界面对我的通行证列表进行排序,但我失败了 public class Pass extends JSONBase implements Comparable<Pass>{ } 恐怕答案很明显,但我就是看不出来!(我当然知道我需要compareTo()方法) 这是一个详细描述问题的错误。它说: The Interface 'java.lang.Comparable' cannot be inherited with different type arguments Y
public class Pass extends JSONBase implements Comparable<Pass>{
}
恐怕答案很明显,但我就是看不出来!(我当然知道我需要compareTo()
方法)
这是一个详细描述问题的错误。它说:
The Interface 'java.lang.Comparable' cannot be inherited with different type arguments
You're trying to inherite it with type JSONBase and Pass.
这意味着JSONBase已经实现了它,不可能再次实现它。您可以在
Pass.java
中覆盖相应的方法。问题正是它所说的JSONBase
已经实现了Comparable
。你不能用不同类型的参数重新实现它。哇。谢谢我我只是觉得自己很愚蠢。。。
'java.lang.Comparable' cannot be inherited with different type arguments:
'com.dendrowen.oveasy.model.JSONBase' and 'com.dendrowen.oveasy.model.Pass
The Interface 'java.lang.Comparable' cannot be inherited with different type arguments
You're trying to inherite it with type JSONBase and Pass.