When will you use Comparator and Comparable interfaces? | Eklavya Online

When will you use Comparator and Comparable interfaces?

java.util.Comparator and java.lang.Comparable

java.util.Comparator compares some other class’s instances,

while java.lang.Comparable compares itself with another object.