Why use compareTo() from Comparable Interface when overriding the compareTo() method?
<p>I have been googling around and the closest response (not answer) is <a href="https://stackoverflow.com/questions/39680973/using-compareto-method-when-overriding-compareto">here</a>, but I am confused of the response.  I am trying to sort some dog names using Collection.sort(), so I need to learn to use Comparable interface.  My questions:</p>

<p>1) why do I need to use the compareTo() that came from the interface when I "override" the compareTo()?<br>
2) If the compareTo() from Comparable interface is a default method, why doesn't it has a "default" keyword in front of the method?  <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html" rel="nofollow noreferrer">Java SE 8 Menu</a></p>

<p>Here is the partial code:</p>

<pre><code>Collections.sort(list);   
for(Dog a: list)   // printing the sorted list of names
     System.out.print(a.getDogName() + ", ");
</code></pre>

<p>Here is the class implement the Comparable interface:</p>

<pre><code>class Dog implements Comparator&lt;Dog&gt;, Comparable&lt;Dog&gt; {
   private String name;
   private int age;

   Dog() {}

   Dog(String n, int a) {
      name = n;  age = a;
   }

   public String getDogName() {
      return name;
   }

   public int getDogAge() {
      return age;
   }

   public int compareTo(Dog d) {
      return (this.name).compareTo(d.name);  //###.....my question
   }

   // Override Comparator Interface's compare() to sort "ages"
   public int compare(Dog d, Dog d1) {
      return d.age - d1.age;
   }
}
</code></pre>