0
Why this string is not printing and how can I make them print
Printing error https://code.sololearn.com/cPU4J6sXsVdY/?ref=app
3 Respostas
+ 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
+ 1
Change your code to StringBuffer sb = new StringBuffer(""+d);
0
shivam Jaiswal
You need to append in StringBuffer
StringBuffer sb = new StringBuffer();
sb.append(d);