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 the purpose of the system class in java programming?
Is java pass by value or pass by reference?
What is the base class of all exception classes in java?
How do you differentiate abstract class from interface?
What is a lightweight component?
What is method in java with example?
Is there any case when finally will not be executed?
What is isa relationship?
Write a java program that prints all the values given at command-line.
What is singleton class example?
What is hasnext in java?
Can we override constructor in java?
Give few difference between constructor and method?
I want to store more than 10 objects in a remote server? Which methodology will follow?
What is the largest data type in java?