My class details attributes of restaurants downtown, said attributes being x/y locations and rank. The problem is, whenever I run the program It throws an error, saying that non-abstract class "Downtown" does not override abstract method "compareTo". I cannot make this class abstract because I need to initialise the object outside this block of code. Where does my program go wrong? Is there a problem with my compareTo implementation? Any suggestions will be much appreciated.
public class Downtown implements Comparable<Downtown> {//Throws error on this line
    private int x;
    private int y;
    private int rank;
    public Downtown(int x, int y, int rank) {
        this.x = x;
        this.y = y;
        this.rank = rank;
    }
    //Appropriate setters and getters for x , y and rank
    public int getX() {
         return x;
    }
    public void setX(int x) {
    this.x = x;
    }
    public int getY() {
    return y;
    }
    public void setY(int y) {
    this.y = y;
    }
    public int getRank() {
    return rank;
    }
    public void setRank(int rank) {
    this.rank = rank;
    }   
    public int compareTo(Downtown p1, Downtown p2)//Actual comparison
    {
        // This is so that the sort goes x first, y second and rank last
        // First by x- stop if this gives a result.
        int xResult = Integer.compare(p1.getX(),p1.getX());
        if (xResult != 0)
        {
            return xResult;
        }
        // Next by y
        int yResult = Integer.compare(p1.getY(),p2.getY());
        if (yResult != 0)
        {
            return yResult;
        }
        // Finally by rank
        return Integer.compare(p1.getRank(),p2.getRank());
    }
    @Override
    public String toString() {
        return "["+x+' '+y+' '+rank+' '+"]";
    }
 
     
    