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 is the base class of all classes?

562


What is the maximum size of a string in java?

543


What is method in java with example?

483


Why call by value prevents parameter value change?

577


What is difference between iterator and enumeration in java?

520






What is method in research paper?

569


Can the garbage collection be forced by any means?

526


What is java volatile?

534


What does this mean java?

549


Why is stringbuffer faster than string?

480


Explain about the interpreter in java?

617


Why do we need autoboxing in java?

510


Can we call thread start () twice?

510


What is a java object and java application?

572


Can we have two main methods in a java class?

533