| Author |
String and StringBuffer
|
Zoram Paul
Ranch Hand
Joined: Jul 10, 2007
Posts: 59
|
|
|
Can anybody explain me when to use String and when the StringBuffer in an application? and Which one is better?
|
ZORAM<br />"If it's true that we are here to help others,<br />then what exactly are the others here for?"
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
StringBuffer has a performance advantage when you concatenate a lot of variable parts into one string. You can try some experiments on your target platform to see when "a lot" becomes worth the effort of using a StringBuffer. StringBuffer is also mutable, meaning you can change it, while String is not. Look through the doc and compare methods. What can one do that the other cannot?
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
|
|
subject: String and StringBuffer
|
|
|