Difference between String and StringBuffer

Difference between String and StringBuffer in Tabular Form

String and StringBuffer Difference




  • The Key Difference between String and StringBuffer is in the below table.
Comparison between String and StringBuffer
Comparison between String and StringBuffer

String and StringBuffer Comparison Chart

String StringBuffer
String class is immutable. StringBuffer class is mutable.
Object of string class can not be changed. Object of StringBuffer class can not be changed.
String is fixed length constants. StringBuffer is a variable length constant.
Strings are slow and consume more memory. StringBuffers are fast and consumes less memory.
String class uses String constant pool for storage. StringBuffer uses Heap memory for storage.




More Difference