Skip to main content
What is the difference between String and String Buffer In Java
String vs StringBuffer
1.String is immutable but String Buffer is mutable.
2.In String equals() method compares contents but in String Buffer compares reference.
3.String is not synchronised but String Buffer is synchronised .
4.String is static in nature but String Buffer is dynamic in nature.
5.String does not allocate additional memory for sixteen elements but in String Buffer allocates additional memory for additional sixteen elements.
6.String + operators works but In String Buffer does not works
Comments
Post a Comment