StringBuffer
The StringBuffer class is an alternative to the String class. You can add, insert, or append new contents into a string buffer, whereas the value of a String object is fixed once the string is created.
StringBuffer is mutable.StringBuffer is a synchronized and allows us to mutate the string. StringBuffer has many utility methods to manipulate the string. It can change in terms of length and content.
StringBuffers are thread-safe,meaning that they have synchronized methods to control access,so that only one thread can access a StringBuffer object's synchronized code at a time.
Thus, StringBuffer objects are generally safe to use in a multi-threaded environment where multiple threads may be trying to access the same StringBuffer object at the same time.
StringBuffer declaration :
public final class StringBuffer
extends Object implements Serializable, CharSequence
Lets check list of method of StringBuffer,
For more details :
http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html
The StringBuffer class is an alternative to the String class. You can add, insert, or append new contents into a string buffer, whereas the value of a String object is fixed once the string is created.
StringBuffer is mutable.StringBuffer is a synchronized and allows us to mutate the string. StringBuffer has many utility methods to manipulate the string. It can change in terms of length and content.
StringBuffers are thread-safe,meaning that they have synchronized methods to control access,so that only one thread can access a StringBuffer object's synchronized code at a time.
Thus, StringBuffer objects are generally safe to use in a multi-threaded environment where multiple threads may be trying to access the same StringBuffer object at the same time.
StringBuffer declaration :
public final class StringBuffer
extends Object implements Serializable, CharSequence
Lets check list of method of StringBuffer,
For more details :
http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html
No comments:
Post a Comment