Monday, October 4, 2010

String Buffer Class

Simply stated, objects of type String are read only and immutable. Any modification to the String will have to create a new String object, while the String Buffer class is used to represent characters that can be modified at runtime.

String represents fixed-length, immutable character sequences. In contrast StringBuffer represents growable and writable character sequences.

This class provides many methods. For example the length () method gives the current length i.e. how many characters are there in the string, while the total allocated capacity can be found by the capacity () method. This is the capacity () function is used to know about the current characters kept which is displayed

Different Methods: