Questionsforum
What is difference between String and string builder?

What is difference between String and string builder?



On 2014-06-16 02:57:10.0
brajeshkumar


Main difference between String and StringBuilder class is that ,

  1. String is immutable where as StringBuilder is not.
  2. Modifying the existing String with new value, creates the new String object in the pool where as In StringBuilder it modifies the existing object with the new value.
  3. Chances of leaving many unused object to be garbage collected but there is no such many unused objects.
  4. String is Thread safe where as StringBuilder is not.


On 2014-06-16 05:30:27.0
sushant

copyright@questionsforum.net