Diff between Comparator and Comparable?
Answer Posted / rajesh
Comparable interface uses Object's compareTo() to compare
the objects. We have to override the compareTo() method in
order to sort.
Where as Comparator, checks for compare() method. You can
sort based on particular property of the object.
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is the difference between import java.util.date and java .util?
What is a generic data type?
What is a parameter in a function?
What language is java written?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
What are the advantages and disadvantages of object cloning?
What are actual parameters?
Are functions objects in java?
What is update method called?
Are floats faster than doubles?
What is an exception in java?
Can we declare a constructor as final?
How can we break singleton in java?
Define linked list and its features with signature?
How do you avoid global variables?