The output of below program:
public class TestClass {
public static void main(final String[] args){
String token = "null\n";
token.trim();
System.out.println("*");
System.out.println(token);
System.out.println("*");
}
}
is:
*
null
*
However
How to remove newlines from beginning and end of a string (Java)?
says otherwise.
What am I missing?