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????????/

That is right and as far as I know that is the only difference....SPEED.

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.