I was just wondering, what does StringBuilder do?
So lets say I have declared this
StringBuilder sb = new StringBuilder();
How do I use string builder in a program?
What is the difference between string and string builder and string buffer?
What's exactly the advantage of using this?
StringBuffer is used to store character strings that will be changed. It automatically expands as needed, when you adding new. String objects not like that, cannot be changed.
StringBuilder was added in Java 5. It is identical to StringBuffer except that it is not synchronized. Means you cannot access it from more than one thread at the same time.