0

I know just the one diff.
1) String Class in Immutable--Means every time we change string, a new object is created & then assigned to the string.

StringBulder Class is Mutable--Means New Object is not created everytime a string is updated.

Is the above diff. rite or wrong????

ny More DIfferences????????/

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sonia sardana
0

Ya U r right Frnd StringBuilder is faster than String Class. Any more diff. If u know plz frd it???

0

Hi
System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
StringBuilder is faster when Compared to string
String each time it creates an object.Hence its called Mutable that is changable
Stringbuilder just appends instead of creating new object
String builder class can provide the formatted string facility alway's u have the posibility for appending it can store large data comparatively String class

http://www.java2s.com/Tutorial/VB/0040__Data-Type/PerformancedifferencebetweenStringandStringBuilder.htm

0

Hey jx_man, I also raed from one of the website that value assigned with string cannot be changed at runtime but using stringBuilder u can change strings at runtime.


Is it rite??If yes,plz give example.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.