A

Admin • 831.35K Points
Coach

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)

Explanation by: Admin
StringBuilder can reverse a string, and this is the correct approach in Java.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.