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 the console in java?
Is singleton set an interval?
What is :: operator in java 8?
What does escaping a character mean?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What is Enum in Java?
Tell me the Importent classes in net package?
Is it possible to write a regular expression to check if string is a number?
What is the difference between the paint() and repaint() methods?
What is a hashmap used for?
What is keyword in oop?
What is a jit compiler?
What is subsequence of a string?
Define inheritance?
What are instance variables?