Diff between Comparator and Comparable?
Answer Posted / qim2010
The “Comparable” interface allows itself to compare with
another similar object (i.e. A class that implements Comparable
becomes an object to be compared with). The following method
are specified in the interface.
public int compareTo(Object o)
public int compareToIgnoreCase(String str)
The "Comparator" interface is used to compare two different
objects. The following method is specified in the Comparator
interface.
public int compare(Object o1, Object o2)
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What are the steps involved to create a bean?
Which is the best approach for creating thread ?
What is oops in java?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
What is finally and finalize in java?
What are the main concepts of oops in java?
What are dot operator queries?
What is the difference between notify and notifyall method?
Which is better singleton or static class?
Do I need java on my pc?
What do you understand by the term string pool?
Why volatile is used in java?
How many bits is a string?
What is update method called?
How do you allocate memory to object?