Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goyuninfo/98da6fe604a15fd92d79d348bf362c18 to your computer and use it in GitHub Desktop.
Save goyuninfo/98da6fe604a15fd92d79d348bf362c18 to your computer and use it in GitHub Desktop.
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