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 is java regex?
What is a function in programming?
What string is utf8?
What are the different types of data structures in java?
Can you call a method on a null object?
Define inheritance?
How do you check if a string contains only numeric digits?
What is the major advantage of external iteration over internal iteration?
What is a substitution variable?
What is the difference between hashmap and hashtable? What is an interface?
What is the default size of set in java?
What are filterstreams?
Explain the features of java?
How to make a non daemon thread as daemon?
What is sizeof in java?