0
Why I'm getting this output.?? can anyone explain plz ...(Note :- plz don't give unnecessary comments) i know you all are genius
3 Antworten
+ 3
You might want:
a = a.concat(b);
Concat returns a new string, doesn't modify the original.
+ 2
concat() doesn't work in place, so "a" isn't changed.
If you want to change "a", reassign:
a = a.concat(b);
+ 2
compare with
StringBuilder a = new StringBuilder("10");
String b = "20";
a.append(b);
System.out.println( a);