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.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
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.