Comparable Interface 1.Comparable is the interface which is present in the java.lang package. 2.We can use this interface to arrange the user defined objects in an order. 3.This interface contains only one method compareTo(Object obj) 4.By using this we can sort the objects based on the single data Member of the objects. Let ‘a’ and ‘b’ are the two objects.If we want to compare those two objects by using compareTo(Object obj) method.We can compare like this: a.compareTo(b); Here ‘a ’ is called as the target object.Where as ‘b ‘ is called as passed in object. If the Target Object is less than the Object that is passed in the return value is negative. if ab return 1; If the Target Object is equal to the Object that is passed in the return value is Zero. If a==b return 0; Solution Comparable Interface 1.Comparable is the interface which is present in the java.lang package. 2.We can use this interface to arrange the user defined objects in an order. 3.This interface contains only one method compareTo(Object obj) 4.By using this we can sort the objects based on the single data Member of the objects. Let ‘a’ and ‘b’ are the two objects.If we want to compare those two objects by using compareTo(Object obj) method.We can compare like this: a.compareTo(b); Here ‘a ’ is called as the target object.Where as ‘b ‘ is called as passed in object. If the Target Object is less than the Object that is passed in the return value is negative. if ab return 1; If the Target Object is equal to the Object that is passed in the return value is Zero. If a==b return 0;.