What is the difference between Comparable and Comparator Interface?

What is the difference between Comparable and Comparator Interface?

The difference between Comparable and Comparator are following:-

                                  Comparable                          Comparator
1 Comparable provides only one sort of sequence. 1 Comparator provides multiple sort of sequences.
2 It provides one method named compareTo(). 2 It provides one method named compare().
3 It is found in java.lang package. 3 It is found in java.util package.
4 If we implement Comparable interface,actual class is modified. 4 Actual class is not modified.

Read More →