0

Why this string is not printing and how can I make them print

Printing error https://code.sololearn.com/cPU4J6sXsVdY/?ref=app

21st Apr 2021, 3:27 AM
Shivam Shiva
Shivam Shiva - avatar
3 Respuestas
+ 3
I got the answer from here https://stackoverflow.com/questions/29989834/cant-get-a-stringbuffer-to-print The issue is that the constructor of StringBuffer takes the argument as size. So instead you can do something like StringBuffer sb = new StringBuffer(1); sb.append(d); So you need to append the character to the buffer then only can print out
21st Apr 2021, 3:40 AM
Hoh Shen Yien
Hoh Shen Yien - avatar
+ 1
Change your code to StringBuffer sb = new StringBuffer(""+d);
21st Apr 2021, 6:02 AM
Abdulaziz Mavlonov
Abdulaziz Mavlonov - avatar
0
shivam Jaiswal You need to append in StringBuffer StringBuffer sb = new StringBuffer(); sb.append(d);
21st Apr 2021, 4:05 AM
A͢J
A͢J - avatar