when implements Comparable interface and override compareTo method,
@Override
public int compareTo(Name o) {
int val = this.name.compareTo(o.name);
if (val != 0) {
return val;
}
if (count != o.count) {
return count - o.count;
}
}
The third line, I realized that I can use compareTo when I override it, and it automatically compares things follows the natural order. But isn't compareTo an abstract method in the comparable interface. Without defining it, it still does compare? Also, why I do not need to use super keyword to distinguish this compareTo.