← Unit 1 · all exercises
Saved in this browser only

Last letter

Return just the last character of the word, as a String. The last position is one before the length.

String last(String word)

Solution.java
Loading editor…
Results

Examples

  • last(Java) → a
  • last(hello) → o

There are also 3 hidden tests you can't see. Solve the problem, not the examples.