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 do you understand by weak reference?
Describe the process as to how substring() methodology mechanisms in java.
What about member inner classes?
Java is Pass by Value or Pass by Reference?
If a method is declared as protected, where may the method be accessed?
How variables are stored in memory?
What is an enumeration?
How do you write a scanner class in java?
What is the purpose of assert keyword used in jdk1.4.x?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
What do you know about the garbage collector?
Which software is used for java programming?
What is the symbol for line break?
What is string [] java?
How do you declare an array that will hold more than 64KB of data?