Untitled Document

Subscribe here to get updates on new Videos

 

6. String vs StringBuffer vs StringBuilder?

 

 

 

previous homenext

 

When to use String, StringBuffer, StringBuilder?

1. If the content is fixed and won’t change frequently then we should go for String.

2. If the content is not fixed and keep on changing but Thread Safety is required then we should go for StringBuffer.

3. If the content is not fixed and keep on changing and thread safety is not required then we should go for StringBuilder.