We will find an answer for the following questions
- What is StringBuffer
- Available Constructors
- Commonly used methods
- Java StringBuffer class is used to create a mutable (modifiable) string.
- The StringBuffer class in java is the same as the String class except it is mutable i.e. it can be changed.
- The Java StringBuffer class is the same as the StringBuilder class except that this one is synchronized.
- So its thread-safe and can be used if Object is shared among multiple threads.
- If sb refers to an instance of a StringBuffer, then sb.append(x) has the same effect as sb.insert(sb.length(), x).