Can we use string builder every time ,is there any complexity increase in my program or any cons of use of string builder every time???
String Builder doubt
HI @Abbas786,
StringBuilder is mutable, while String is immutable. Immutable means it doesn’t change.In other words like array we cannot do String str; and then str[i]=‘a’; we cannot modify the value of string and we add two strings then actually we create a third string containing string one + string two . While in case of string builder you can modify str[i]=‘a’ or stating it otherwise you can change the value of index i in string builder. String is way more efficient if you do not want to use these extra feature
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.