1.

Difference between comparator and comparable with an example

Answer»

ANSWER:

COMPARABLE is USED to compare itself by using with another object. COMPARATOR is used to compare two datatypes are objects. If you see then logical difference between these two is Comparator in Java compare two objects provided to him, while Comparable INTERFACE compares "this" reference with the object specified.



Discussion

No Comment Found

Related InterviewSolutions