Java StringBuilder(String str) Constructor
Syntax
StringBuilder(String str) constructor from StringBuilder has the following syntax.
public StringBuilder(String str)
Example
In the following code shows how to use StringBuilder.StringBuilder(String str) constructor.
/*from ww w. ja va2 s .c o m*/
public class Main {
public static void main(String[] arg) {
String phrase = "abced";
StringBuilder buffer = new StringBuilder(phrase);
System.out.println(buffer);
}
}
The code above generates the following result.