Java StringBuffer.insert(int offset, char c)
Syntax
StringBuffer.insert(int offset, char c) has the following syntax.
public StringBuffer insert(int offset, char c)
Example
In the following code shows how to use StringBuffer.insert(int offset, char c) method.
//from www . jav a 2 s . c o m
public class Main {
public static void main(String args[]) {
StringBuffer buffer = new StringBuffer();
char characterValue = 'K';
buffer.insert(0, characterValue);
System.out.println(buffer.toString());
}
}
The code above generates the following result.