search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
57 views
asked Expert 13.2k points 27 40 59

1 Answer

0 votes
String and StringBuilder classes are used to store string values but the difference in them is that String is immutable (read only) by nature, because a value once assigned to a String object cannot be changed after its creation. When the value in the String object is modified, a new object is created, in memory, with a new value assigned to the String object. On the other hand, the StringBuilder class is mutable, as it occupies the same space even if you change the value. The StringBuilder class is more efficient where you have to perform a large amount of string manipulation.
 
answered Guru 24.6k points 29 52 81

Related questions

0 votes
1 answer 18 views
0 votes
1 answer 108 views
108 views
In C# what is the difference between String and string?
asked shivani Sr Member 1.1k points 13 27 42
0 votes
1 answer 41 views
41 views
asked sara Guru 24.6k points 29 52 81
0 votes
1 answer 391 views
391 views
asked shivani Sr Member 1.1k points 13 27 42
0 votes
1 answer 44 views
44 views
asked rock Expert 15k points 15 23 30
...