我正在尝试在Comparable界面的帮助下对通行证列表进行排序,但我失败了。

public class Pass extends JSONBase implements Comparable<Pass>{

}


此行会引发Android Studio中的下一个错误:

'java.lang.Comparable' cannot be inherited with different type arguments:
'com.dendrowen.oveasy.model.JSONBase' and 'com.dendrowen.oveasy.model.Pass'


恐怕答案很明显,但我看不到! (我当然知道我需要compareTo()方法)

最佳答案

'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.


这意味着JSONBase已经实现了它,并且不可能再次实现它。您可以在@OverridePass.java适当的方法

07-24 18:35
查看更多