Java StringBuilder.insert(int offset, Object obj)
Syntax
StringBuilder.insert(int offset, Object obj) has the following syntax.
public StringBuilder insert(int offset, Object obj)
Example
In the following code shows how to use StringBuilder.insert(int offset, Object obj) method.
//from ww w . j a v a 2 s . c o m
public class Main {
public static void main(String args[]) {
StringBuilder buffer = new StringBuilder();
Object objectRef = "java2s.com";
buffer.insert(0, objectRef);
System.out.println(buffer.toString());
}
}
The code above generates the following result.