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 is parameter example?
What is bifunction in java?
Explain about java sdk?
What java is used for?
What is javac_g?
What do you mean by inner class in java?
Difference between abstract and concrete class ?
What is comparator in java?
When super keyword is used?
What is size () in java?
Can you add null to a list java?
How do you use parseint in java?
What is parameters example?
Do we need to manually write Copy Constructor?
What is a bubble sort in java?