I need to call the method compareTo from a class that I made, but I cannot make this class abstract. So when I try to call compareTo, it says that the class isn't abstract and that it dosent override the compareTo method. How do you work around this? This is an assignment and I cannot post code, but this is the method header:
class Customer implements Comparable<Object>
@Override
public int compareTo(Customer c)
{
//comparison
}
Your class implements the wrong generic interface. If you want it to be comparable to itself, it should implement Comparable<Customer>
.