StringBuilder.insert(int offset, Object obj) has the following syntax.
public StringBuilder insert(int offset, Object obj)
In the following code shows how to use StringBuilder.insert(int offset, Object obj) method.
/*from w w w . ja v a 2 s . co 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.