CompareTo method does have an implementation. The method is implemented in all the classes such as Integer, Double etc. In your case you are using String’s compareTo method.
If you want it to be customized as per your class, you do so by overriding the compareTo method.
1
solved how comparable interface return int value, if an interface having only method declaration