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 advantages of defining packages in java?

743


We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.

1717


What is the difference between a constructor and a method?

868


What is int argc char * argv?

790


What are different types of arrays?

749


How many functional interfaces does java 8 have?

809


give an example for encapsulation?

777


Explain the difference between jvm and jre?

795


What exceptions occur during serialization?

853


Can a final method be overloaded?

723


What do you mean by garbage collection used in java?

811


How does list work in java?

701


What languages are pass by reference?

783


What is a function easy definition?

743


Why char array is favored over string for the storage of passwords?

782