How TreeMap sorts the objects inside it?? suppose if have
include one employee object and one car object. On what
basis it will sort?

Answer Posted / shaik baji

The TreeMap sorts the objects in assending order by
depending on the key value.

The Key value must be "String" type so internally it will
sort the keys by using "compareTo" method.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between graph and tree?

885


Can we convert stringbuffer to string?

787


What do you mean by buffering?

798


What are memory tables?

854


what are Hostile Applets?

1826


What is a function easy definition?

762


What is difference between word and integer?

828


Why is static used?

794


Can a lock be acquired on a class in java programming?

752


Why do we use return statement?

790


What is a generic code?

751


Can we serialize static variables in java?

881


Can an abstract class be a final class?

742


What is the difference between object oriented programming language and object based programming language?

779


What are the legal operands of the instanceof operator?

804