stringbuilder


1. Overview. In this short article, we're going to look at similarities and differences between StringBuilder and StringBuffer in Java. Simply put, StringBuilder was introduced in Java 1.5 as a replacement for StringBuffer. 2. Similarities. Both StringBuilder and StringBuffer create objects that hold a mutable sequence of characters.



StringBuffer is Thread safe and StringBuilder is not. StringBuilder is a new class on StringBuffer Api and it was introduced in JDK 5 and is always recommended if you are working in a Single threaded environment as it is much Faster . Next : What is the difference between creating String as new () and literal? Related Topics