public class TestOctagon {
public static void main(String[] args) {
Octagon octagon = new Octagon(1);
System.out.println("1st Octagon " + octagon.toString());
System.out.println("The area is " + octagon.getArea());
System.out.println("The perimeter is " + octagon.getPerimeter());
Octagon octagon1 = new Octagon(2);
System.out.println("2nd Octagon " + octagon1.toString());
System.out.println("The area is " + octagon1.getArea());
System.out.println("The perimeter is " + octagon1.getPerimeter());
System.out.println(octagon == octagon1);
System.out.println(compareTo(octagon1)); //I'm trying to compare octagon to octagon1 but I keep getting an error message.

if you are using compareTo for two objects then that object should implement comparable interface. and compareTo will be used to compare two objects while you are using only one. it will be object1.compareTo(object2)
For example. String implements comparable interface.
String test = "hi";
String test1 = "HI";

cheers !!!!!!