Hi again Danish,
Ok, let's take another crack at this. Are you asking why SUN in it's infinite wisdom decided to allocate a default buffer with a 16 char capacity?
If that's your question, I have no earthly, freakin' idea, but I suspect it went something like this:
System engineer dude 1:
"Hey Joe how may char's should the initial buffer in StringBuffer hold?"
System engineer dude 2:
"Gee Harry, I don't know. Let me do some performance
testing and I'll get back with you on that."
.....
Two weeks later
System engineer dude 2:
"Hey Harry, I've got that data back on the initial buffer size for StringBuffers." It looks like somewhere around 13 characters gets the best performance."
System engineer dude 1:
"O, thanks Joe. What do you say we set it at 16 always best to use a power of 2 don't you think?"
System engineer dude 2:
"You bet. 13 would make us look like a bunch of Microsoft engineers."
I hope that answers your question.
Now if the default is a problem, you can set the initial buffer to whatever you want with:
Hope this helps :roll:
Michael Morris
SCJP2