I have written some code and used a string that I concatentated using the += (as I only do it a couple of times.
Later on I used another string and used the concat() function. and the concatenation didn't work.
So I wrote a little method in Junit (with eclipse)...
@Test public void StingConcatTest(){ String str = ""; str += "hello "; str += " and goodbye"; String conc=""; conc.concat("hello "); conc.concat(" and goodbye"); System.out.println("str is: " + str + "\nconc is: "+ conc); The output is...
str is: hello and goodbye conc is: So either I'm going mad, I'm doing something wrong (most likely), there is an issue in JUNIT, or there is a problem with my JRE / eclipse or something.
Note that stringbuilders are working fine.
David.