comparable

what is comparable in Java

Hierarchy package: java.lang.Comparable Definition Sorting interface that designed for a condition by overriding compareTo method. For example, you can sort list in ascending order of size. about the compareTo() method if compareTo() method return positive number, swap the input parameters else will be remain same condition return First parameter < second parameter negative First parameter == second parameter 0 First parameter > second parameter positive How to use customObject implements Comparable<>