String is meant to store some character data.
StringBuilder is meant to manipulate character data.
Although we manipulate character data using String as well, but it is not efficient, as every time we do a new instance of the String class is created.
StringBuilder class that is optimized for string concatenation. It provides the same benefits as using a character array in C/C++, as well as automatically growing the buffer size (if needed) and tracking the length
No comments:
Post a Comment