Skip to content

Instantly share code, notes, and snippets.

package info.goyun;
public class StringBuilderDemo {
public static void main(String[] args) {
StringBuilder str = new StringBuilder("Go.info");
System.out.println("string = " + str);
// insert character value at offset 2
str.insert(2, "Yun");
// prints StringBuilder after insertion
System.out.print("After insertion = ");
System.out.println(str.toString());
//output: After insertion = GoYun.inf
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment