Difference between String, StringBuffer and StringBuilder

preview_player
Показать описание
String
1. Immutable
2. If content is fixed and won’t change frequently.

StringBuffer
1. Mutable
2. If content is not fixed and keep on changing but thread safety is required.

StringBuilder
1. Mutable
2. If content is not fixed and keep on changing and thread safety is not required means you can allow multiple thread running on that content then we can use StringBuilder

Рекомендации по теме