As I said in title, I'm creating a parent class implementing Comparable interface in it but without implement compareTo()
method and this is causing an error in child classes but not in Parent class ¿Why?
This is a sample:
public abstract class EarthquakeMarker extends CommonMarker implements Comparable<EarthquakeMarker>
{
// I know that I need to implement compareTo() here
}
My child classes are:
public class LandQuakeMarker extends EarthquakeMarker {
}
public class OceanQuakeMarker extends EarthquakeMarker {
}
Both child classes are complaining about the implementation of compareTo()
method. I want to know why this error appears in child classes instead of the parent class which is the class that's using the comparable interface