What is compareto () in java?



What is compareto () in java?..

Answer / Rajkishor Singh

The compareTo() method in Java compares two objects based on their lexicographic order, which is based on the Unicode values of their characters. It returns 0 if they are equal, a negative number if the first object comes before the second, and a positive number otherwise.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What 5 doubled?

1 Answers  


what do you mean by marker interface in java?

1 Answers  


Explain cookies?

2 Answers   Canon,


Why java uses the concept of the string literal?

1 Answers  


Why main function is static?

1 Answers   MCN Solutions,


What are different types of states exist for a thread?

1 Answers  


What is a J2EE component? List out all the component?

2 Answers   Adobe,


From the two, which would be easier to write: synchronization code for ten threads or two threads?

1 Answers  


What are format specifiers in java?

1 Answers  


Why is Java a platform independent language?

1 Answers  


IS method overriding is Duplication of Methods?

5 Answers   CybAge,


Explain the scope or life time of class variables or static variables?

1 Answers  


Categories