What is comparable interface?



What is comparable interface?..

Answer / Neeraj Mishra

The Comparable interface in Java defines a total order between the objects of a class that implements it. It contains one abstract method called compareTo(Object o) which returns a negative integer, zero or positive integer depending on whether the object implementing this method is less than, equal to or greater than the specified object.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

Is pointer a variable?

1 Answers  


What's the difference between a hashtable and a hashmap?

1 Answers  


Which sorting algorithm is best for large data?

1 Answers  


Can a stack be described as a pointer? Explain.

1 Answers  


What is a priority queue?

1 Answers  


How to sequentially represent max-heap?

1 Answers  


How do you declare A pointer to array of three chars

1 Answers  


What is difference between data type and data structure?

1 Answers  


What is the purpose of thread?

1 Answers  


What is sorting rule in shapes?

1 Answers  


Which data structure is used to perform recursion?

1 Answers  


what is a balanced tree.

1 Answers  


Categories