Home > DeveloperSection > Interviews > What is the difference between String and String Buffer?

Posted on    October-25-2010 12:00 AM

 Java Java 
 1 Answer(s)
  2222  View(s)
Rate this:

Pushpendra Singh

Total Post:241

Posted on    November-08-2010 1:00 AM

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.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.

Don't want to miss updates? Please click the below button!

Follow MindStick