Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法实现可比性_Java_Android_Extend_Comparable - Fatal编程技术网

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.