Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consisting of the last three characters of the value of word

Assume that word is a variable of type String that has been assigned a value.  Write an expression whose value is a String consisting of the last three characters of the value of word

LANGUAGE: Java

CHALLENGE:

Assume that word is a variable of type String that has been assigned a value.
Write an expression whose value is a String consisting of the last three characters of the value of word.
So if the value of word were “biggest” the expression’s value would be “est”.

SOLUTION:

word.substring(word.length() - 3,word.length())


Add comment