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 are class members by default?
What is the largest number a double can hold?
Is java a super set of javascript?
What is treeset in java collection?
Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?
Can a source file contain more than one class declaration?
What is the difference between a window and a frame in java programming?
How many tetrahedral voids are there in bcc?
Why is java so popular?
What is the difference between object oriented programming language and object based programming language?
How will you compute size of a structure?
What do you mean by order of precedence and associativity?
What is a instance variable?
how many types of Inheritance?
Explain the use of sublass in a java program?