What is compareto?



What is compareto?..

Answer / Ankush

In Java, compareTo() is a method defined in the Comparable interface. It compares two objects based on their inherent ordering. For example, in String class, it compares strings lexicographically.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the difference between interface & abstract class?

1 Answers  


List the interfaces which extends collection interface?

1 Answers  


What is difference between overloading and overriding?

2 Answers   Accenture,


how to open and edit XML file in Weblogic???

1 Answers   Symphony,


Is node a data type in java?

1 Answers  


Explain about method local inner classes or local inner classes in java?

1 Answers  


Why we override equals() method?

1 Answers  


Difference between static synchronization vs. Instance synchronization?

1 Answers  


Which all r Final classes in java except string?

5 Answers   HCL,


If a multi threaded Java program has started numerous number of threads, at any point in time how to know which thread is currently executing/running ?

7 Answers   Accenture, College School Exams Tests, iFlex, NIIT,


What is difference between array and arraylist in java?

1 Answers  


What is the difference between a scrollbar and a scrollpane?

1 Answers  


Categories