StringBuffer
- class java.lang..StringBuffer public final class StringBuffer extends Object implements Serializable Tree:java.lang.Object - java.lang.StringBuffer A string buffer implements a mutable sequence of characters. A string buffer is like a , but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. StringBuffer() - Constructor for class java.lang.StringBuffer public StringBuffer () Constructs a string buffer with no characters in it and an initial capacity of 16 characters. StringBuffer(String) - Constructor for class java.lang.StringBuffer public StringBuffer (String str) Constructs a string buffer so that it represents the same sequence of characters as the string argument; in other words, the initial contents of the string buffer is a copy of the argument string. The initial capacity of the string buffer is 16 plus the length of the string argument.Parameters: str - the initial contents of the buffer. StringBuffer(int) - Constructor for class java.lang.StringBuffer public StringBuffer (int length) Constructs a string buffer with no characters in it and an initial capacity specified by the length argument.Parameters: length - the initial capacity.Throws: NegativeArraySizeException - if the length argument is less than 0. | ||||
Search Dictionary:
StringBuffer definition was found in categories: Encyclopedia(1)
StringBuffer Definition from Encyclopedia Dictionaries & Glossaries
| Wikipedia English - The Free Encyclopedia |
StringBuffer and StringBuilder
The class is one of two core string classes in the Java programming language. Most of the time, the class is used, however, the
StringBuffer class is a mutable object while String is immutable. That means the contents of StringBuffer objects can be modified while similar methods in the String class that appear to modify the contents of the string actually return a new String object. It is more efficient to use a StringBuffer instead of operations that result in the creation of many intermediate String objects. The class, introduced in J2SE 5.0, differs from StringBuffer in that it is unsynchronized. When only a single thread at a time will access the object, using a StringBuilder is more efficient than using a StringBuffer.| See more at Wikipedia.org... |
