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
How do you generate random numbers in java?
How do you sort arraylist in descending order?
List some oops concepts in java?
What is the longest unicode character?
Can private members of a base class are inheritable justify?
What is the purpose of lambda expressions?
Can inner class extend any class?
Can we clone singleton object in java?
What is a qms manual?
What is null in java?
What is the final method?
What one should take care of, while serializing the object?
which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com
How do you calculate square roots?
Which is faster call by value or call by reference?