comparator and comparable
a)A comparable object is capable of comparing itself with another object while a comparator object is capable of comparing two different objects.
b)The Comparable class itself implements the java.lang.Comparable interface in order to compare its instances while the Comparator class does not compare its instances, but some other class?s instances.
For more information, visit the following links:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.