199k views
0 votes
Given a string variable named sentence that has been initialized , write an expression whose value is the the very last character in the string referred to by sentence.

1 Answer

3 votes
Strings can usually be dealt with as arrays of characters.

sentence[ -1 ]

sentence.substring( sentence.size() -1 );
User Antrikshy
by
8.2k points