Consider the following:
What is the output?
String.trim() removes whitespace only from the beginning and end of a string. The internal spaces remain, so "Java SE 8 1" has a length of 11 characters.
String.trim()
"Java SE 8 1"
Community Discussion