Home » JAVA Programming » Basic Datatypes » Question
  1. If we try to add Enum constants to a TreeSet, what sorting order will it use?
    1. Sorted in alphabetical order of Enums
    2. Sorted in the order of declaration of Enums
    3. Sorted based on order() method
    4. Sorted in descending order of names of Enums
    5. None of these
Correct Option: B

Tree Set will sort the values in the order in which Enum constants are declared.



Your comments will be displayed only after manual approval.