在方法petInteraction()中,我希望在运行代码时按照情绪级别对宠物进行排序,这样用户就可以首先选择要照顾的宠物。目前,我已经包含了一个新的方法sort(),但是它导致了一个错误。我正在使用eclipse,错误是:
Exception in thread "main" java.lang.ClassCastException: [I cannot be cast to java.lang.Comparableat
我知道如何使用Arrays.sort()方法按以下方式对对象数组进行排序。Arrays.sort(array of primitive type); Arrays.sort(array of an object type);
Arrays.sort(array of an object type , from