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 java objectoutputstream?
What is time complexity java?
What is the use of conditional statement?
What is type conversion in java?
What class allows you to read objects directly from a stream?
Explain about map interface in java?
What are the differences between processes and threads?
What is main function purpose?
What is the difference in between cpp and java? Can u explain in detail?
What is constructor chaining and how is it achieved in java?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
How define set in java?
If a method is declared as protected, where may the method be accessed?
Do extraneous variables affect validity?
What is a finally block?