A

Admin • 828.43K Points
Coach

Q. How can you get the last character of a string `s`?

  • (A) s.charAt(s.length())
  • (B) s.charAt(s.length - 1)
  • (C) s.charAt(s.length() - 1)
  • (D) s.last()

Explanation by: Admin
s.charAt(s.length() - 1) returns the last character of a string.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.