The Amazing Concept of Strings in Java ( String API )

video


StringBuffer & StringBuilder API

If any of your programs or projects requires lots of modifications to strings then you should consider using StringBuffer or StringBuilder class which is located in java.lang package. There is no much difference between these two class except that StringBuilder is not thread safe which was introduced in JDK 1.5.
Since StringsBuilder is not thread safe it takes less time to execute. You should make use of it in your program where ever it can be instead of using StringBuffer.

 

StringBuffer is synchronized and StringBuilder is not.
StringBuilder works faster as it is not thread safe

Below program will help you understand how much faster StringBuilder is 🙂

 


Strings in Java Interview Questions

Strings in Java Interview Questions :