Difference between String & StringBuffer
Answer Posted / niranjanravi
String objects are constants and immutable where as
StringBuffer objects are not.StringBuffer Class supports
growable and modifiable string where as String class
supports constant strings. Strings once created we cant
modify them. Any such attempt will lead to the creation of
new strings.Where as StingBuffer objects after creation
also can be able to delete oo append any characteres to
it.String values are resolved at run time where as
StringBuffer valuesc are resolved at compile time.So if you
know the exact size of the string to be appended it is
better to go for String objects.
Is This Answer Correct ? | 194 Yes | 19 No |
Post New Answer View All Answers
What are strings in physics?
Why heap memory is called heap?
What are the features of junit?
Can constructor be synchronized?
What is dot operator?
What is the purpose of void?
Does java have a compiler?
Why do we use variables?
What is a type parameter in java?
what is the difference between future and callable interface in java?
Explain what access modifiers can be used for methods?
Can a java program have 2 main methods?
What does nextint () do in java?
what is the swingutilities.invokelater(runnable) method for? : Java thread
What is return null in java?