|
While learning about strings, you might have noticed that many strings are created and immediately lost when you do many manipulations on a string (see figure 13.9). Since the strings are immutable, each time you modify something (even a single character), a new string object is created. This is not a very good solution when you need to do a lot of string manipulations. You may end up with many lost strings in the memory. The StringBuffer class provides you with a better alternative. This class represents a string that can be modified without creating too many lost objects.