I am writing a compareTo method for the Comparable Interface for a specific class. I need to take two different strings and compare them and see if one holds a greater value than the other. I would normally use .compareTo() but in this case it is giving me an error and not working.
This is what I have:
public int compareTo(Object o) {
if (name < ((AccountOwnerComparable) o).name)
return -1;
else if (name > ((AccountOwnerComparable) o).name)
return 1;
else
return 0;
}
I know I can't use the < or > but it is just to show what the scenario is.