Assume that word is a variable of type String that has been assigned a value

Assume that word is a variable of type String that has been assigned a value

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 first three characters of the value of word. So if the value of word were “dystopia” the expression’s value would be “dys”.

SOLUTION:

word.substring(0,3)


Add comment