Java collections with comparable
<p>I try to create a collection. Just a small collection with 3 names and i want to sort them by Alphabetically order. and it hits me always this error: Exception in thread "main" java.lang.AbstractMethodError: collection.compareTo(Ljava/lang/Object;)I. in the line: Collections.sort(names); what should i do to overcome my problem?</p>

<pre><code> public  class collection implements Comparable&lt;collection&gt; {

private String name;

public collection(String name){
    this.name= name;

}

public String getName(){

    return name;

}

public int compareΤο(collection c){
    return this.getName().compareTo(c.getName());

}

}


public class collectionList {

private ArrayList &lt;collection&gt; names;

public collectionList(){
    names = new ArrayList &lt;collection&gt;();
}
public void populate() {
    collection c1 = new collection("Monica Rows");
    names.add(c1);
    collection c2 = new collection("Peter Walker");
    names.add(c2);
    collection c3 = new collection("Jack Miller");
    names.add(c3);


  }

public void sortBy(){
    Collections.sort(names);
}

public String names(){
    String s="";
    for(collection c: names){
        s+=c.getName()+ "\n";
    }

    return s;
}



 }

public class collectionMain {


public static void main(String[] args){
    collectionList c = new collectionList();
    c.populate();
    System.out.println(c.names());

    c.sortBy();
    System.out.println(c.names());
}
</code></pre>

<p>}</p>
