Java String Builder also performs same like String buffer Class and create mutable and modifiable Strings except that the process is not synchronized. So String builder Class I available from JDK 15.
String Builder Consist of 3 Constructors
1) StringBuilder() → which create a String Builder of length 16.
2) StringBuilder(int length) → this constructor creates a string builder of given length .
3) StringBuilder(String str)→ this Constructor creates String Builder of the string parameter.
String builder also provides few methods like String Buffer and few of those methods are stated below with example→
The Length Method of String Builder Class returns the ttal count of character in the string.
The capacity method of String Builder returns the size of String builder as it Default capacity when initialize is 16 and increases based on (previous_Capacity * 2) +2 , as string gets append.
the Replace String Builder replaces the string characters with the string passed as an argument based on the start index and end index passed as argument.