Please read the API doc for the trim method to see what it is supposed to do.
The API doc is here: http://docs.oracle.com/javase/8/docs/api/index.html

Look at the API doc for the String class. ...