Q. In the real-world, which method reference helps when sorting a list of strings alphabetically?

  • (A) String::length
  • (B) String::compareTo
  • (C) String::toLowerCase
  • (D) String::isEmpty
πŸ’¬ Discuss
βœ… Correct Answer: (B) String::compareTo
Explanation: `String::compareTo` is used for natural ordering of strings.
Explanation by: Mr. Dubey
`String::compareTo` is used for natural ordering of strings.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
79
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
87%
Success Rate