Sorting problem cannot instantiate abstract object overriding compareTo() Method
<p>I'm trying to establish a new sort criteria, in this case by name.
I'm facing an error when I call the sort method...</p>

<p>this is a separated class (SortByName) in package "package":</p>

<p>-----------------------CLASS SortByName---------------------------</p>

<p>package package;</p>

<p>import java.util.*;</p>

<p>public abstract class SortByName implements Comparator{</p>

<pre><code>public int compareTo(Object o1, Object o2){
    String n1 = ((Ficha)o1).getName();
    String n2 = ((Ficha)o2).getName();
    return n1.compareTo(n2);
</code></pre>

<h2>}</h2>

<p>and then inside an ActionPerformed event I have this:</p>

<p>----------------IN THE ACTION EVENT BUTTON----------------------------</p>

<p>Collections.sort( list , <strong><em>new SortByName()</em></strong> ); </p>

<h2><strong>"package.SortByName is abstract,> cannot be instantiated"</strong></h2>

<p>I tried changing the "abstract" type in the class definition (SortByName) , but it complies about not overriding the compareTo() method.</p>

<p>thanks for reading.</p>
