+ 1
JAVA Stringbuffer
Example : Stringbuffer example = new Stringbuffer(5); the 5 was the capacity/size for the Stringbuffer as i know, but can anyone show me what the 5 mean,i mean how many int i can add to it to reach it maximum size
1 Odpowiedź
+ 1
capacity grows dynamically so you can append an almost arbitrarily long string,
(it is limited with the max value of the used index (int) and capacity of your memory only.)
without parameters, initial capacity is 16,
if you know your minimal capacity is eg about 512 you can help set better initial capacity.
StringBuilder is the newer faster version of it