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 synonym of string?
What is javac_g?
What is the benefit of inner classes in java?
Why is logger singleton?
What are three ways in which a thread can enter the waiting state in java programming?
Do I need java on my computer?
What is the major difference between linkedlist and arraylist?
What is the difference between char and char *?
Which are different kinds of source code?
Can a constructor have different name than a class name in java?
Explain the hierarchy of java exception classes?
Explain the importance of throwable class and its methods?
Can an integer be null java?
What is defined as false sharing in the context of multithreading?
How to display names of all components in a Container?