Consider the code below,
String s = "TEST";
String s2 = s.trim();
s.concat("ING");
System.out.println("S = "+s);
System.out.println("S2 = "+s2);
Output obtained :
S = TEST
S2 = TEST
BUILD SUCCESSFUL (total time: 0 seconds)
Why "ING" is not concatenated?