+ 1

In this program; when i have set the capacity to 20 and tried to print that it is even printing the same as initial .why?

https://code.sololearn.com/c9ssCVlBLWKa/?ref=app and even when i am replacing some text or appending some text which needs more capacity then the initial ones it doesn't denied. but i thought it should give an error or exception.😟

14th May 2018, 1:19 PM
himani
2 odpowiedzi
0
Explain yourself please, what do you expect from the code and what did you get? What is this program? etc.
15th May 2018, 4:28 AM
Eldar Bakerman
0
I have declared a stringbuffer when i make any change in the object ;it should permit those changes in original object. Because it has 16 more vacant spaces so that all changes can be done. Now i have taken a string of length 13 then its capacity =13+16=29; same it is printing .But after that i have set the capacity to 20 that means object should permit any change till then its all vacant spaces will fill. But i have made changes more than that's capacity(20) it is permitting.
15th May 2018, 5:04 AM
himani