Q. Which lambda expression will reverse a given string 's'?

  • (A) s -> new StringBuilder(s).reverse().toString()
  • (B) s -> s.reverse()
  • (C) s -> s.revert()
  • (D) s => reverse(s)
πŸ’¬ Discuss
βœ… Correct Answer: (A) s -> new StringBuilder(s).reverse().toString()
Explanation: StringBuilder can reverse a string, and this is the correct approach in Java.
Explanation by: Mr. Dubey
StringBuilder can reverse a string, and this is the correct approach in Java.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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