Search Interview Questions
| More than 3000 questions in repository.|
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. WEDNESDAY |
Only one FRIDAY will be printed as Set doesn't allow duplicates.Elements will be printed in the order in which constants are declared in the Enum. TreeSet maintains the elements in the ascending order which is identified by the defined compareTo method. compareTo method in Enum has been defined such that the constant declared later are greater than the constants declared prior.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   code   coding   enum   set   treeset   advanced|
Try 3 Question(s) Test
|Difference beween HashSet and TreeSet ?|
|What is comparator interface used for ?|
|If I try to add Enum constants to a TreeSet, What sorting order will it use ?|
|Which are the sorted collections ?|
|If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?|
|What is the difference between TreeSet and TreeMap ?|
|Which of the following is insertion heavy - HashSet or TreeSet ?|
|How to sort objects based on one of the field ?|