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
How can we access some class in another class in java?
What are the important features of Java 8 release?
Is char * a string?
What is bean? Where it can be used?
Should a main method be compulsorily declared in all java classes?
What is functional interface in java?
What is keyword in oop?
What are the advantages of compiled language?
What is a condition in programming?
What is the basic difference between string and stringbuffer object?
What is comparator in java?
Which is better stringbuilder or stringbuffer?
What are the basics of core java?
Can inner class extend any class?
Why vector class is used?