0% found this document useful (0 votes)
13 views1 page

Java StringBuffer vs StringBuilder Guide

Uploaded by

balapaithara79
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Java StringBuffer vs StringBuilder Guide

Uploaded by

balapaithara79
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

StringBuffer sb = new StringBuffer("Hello");

[Link](" World!");
[Link](5, ",");
[Link](6, 11, "Java");
[Link](5, 6);
[Link]();
int cap = [Link]();
int len = [Link]();
char ch = [Link](0);
[Link](0, 'H')
String str = [Link]();
String StringBuffer StringBuilder
Feature
(Immutable) (Mutable) (Mutable, Faster)
Modifiable ❌ No ✅ Yes ✅ Yes
✅ Yes ❌ No (Not
Thread-Safe ✅ Yes (Immutable)
(Synchronized) Synchronized)
❌ Slow (New ⚡ Moderate 🚀 Fast (Better
Performance
object every time) (Thread-safe) Performance)

You might also like