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
What is public/private protected in java?
What is difference between pointer and reference?
What is length in java?
Can we convert stringbuilder to string in java?
Can we overload the methods by making them static?
What is your platform?s default character encoding and how to know this?
What is the purpose of the finalize() method?
What is set string?
Explain different ways of creating a thread. Which one would you prefer and why?
How do you do descending order in java?
Should you use singleton pattern?
What is static import in java?
Can we use both this () and super () in a constructor?
Difference between == and .equals() ?
What is files manifesting?