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 local variables?
Difference between start() and run() method of thread class?
which pattern is default in scanner package?
What is static synchronization?
How do you declare an array that will hold more than 64KB of data?
Is arraylist sorted in java?
How we can execute any code even before main method?
Explain what pure virtual function is?
What are the different tags provided in jstl?
Name few "optional" classes introduced with java 8 ?
What are different types of multitasking?
Can we overload the constructors?
What are the 6 functions?
What does jenkins do?
Are variables stored in ram?