0

Why I'm getting this output.?? can anyone explain plz ...(Note :- plz don't give unnecessary comments) i know you all are genius

https://code.sololearn.com/cW0zkvXl9I3k/?ref=app

20th Apr 2022, 5:52 PM
Davinder Kumar
Davinder Kumar - avatar
3 Respostas
+ 3
You might want: a = a.concat(b); Concat returns a new string, doesn't modify the original.
20th Apr 2022, 6:04 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
concat() doesn't work in place, so "a" isn't changed. If you want to change "a", reassign: a = a.concat(b);
20th Apr 2022, 6:04 PM
Lisa
Lisa - avatar
+ 2
compare with StringBuilder a = new StringBuilder("10"); String b = "20"; a.append(b); System.out.println( a);
20th Apr 2022, 7:13 PM
zemiak