Q. If we add Enum constants to a TreeSet, what sort order will it use?

  • (A) Sorted by sort() method
  • (B) Sorted in the order of declaration in Enums
  • (C) Sorted alphabetically by Enums
  • (D) Sorted in descending order
πŸ’¬ Discuss
βœ… Correct Answer: (B) Sorted in the order of declaration in Enums
Explanation: TreeSet will sort the values in the order in which the Enum constants are declared.
Explanation by: Admin
TreeSet will sort the values in the order in which the Enum constants are declared.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
220
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
94%
Success Rate