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 difference between path and classpath variables?
What is args length in java?
What ide should I use for java?
What is the static variable?
What is unicode used for?
Which one of the following suits the description of a string better: derived or primitive?
What are basic data types?
What is a class variable?
How big is a 64 bit float?
Can we serialize arraylist in java?
How to create com object in Java?
Why java is considered as platform independent?
What is stored procedure. How do you create stored procedure ?
What are the differences between this and super keyword?
What is thread safe java?