- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why StringBuffer is mutable in Java?
We all know that the String class in Java is mutable i.e. once we create a String variable we cannot modify its data or do any manipulations.
But, there may be scenarios where we need to modify the data of String variables. In such cases, we could use StringBuffer class.
This class −
- is like a String, but can be modified.
- It contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.
- Is safe for use by multiple threads.
- Related Articles
- Is StringBuffer final in Java?
- Java StringBuffer class.
- Why should we use a StringBuffer instead of a String in Java?\n
- Constructors of StringBuffer class in Java.
- Methods of StringBuffer class in Java.
- What is the difference between StringBuffer and StringBuilder in java?
- Difference between StringBuilder and StringBuffer in Java
- Difference between string and StringBuffer in Java.
- What is the difference between a StringBuffer and StringBuilder in java?
- Java String, StringBuffer and StringBuilder Tutorial.
- Java Program to Clear the StringBuffer
- Sorting collection of String and StringBuffer in Java
- Difference Between String and StringBuffer Class in Java
- Change a single character in a Java StringBuffer object in Java
- Mutable keyword in C++?

Advertisements