Java StringBuffer.insert(int offset, char[] str)

Syntax

StringBuffer.insert(int offset, char[] str) has the following syntax.

public StringBuffer insert(int offset,   char[] str)

Example

In the following code shows how to use StringBuffer.insert(int offset, char[] str) method.


//from ww w. j  a v  a2 s. com
public class Main {
  public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();


    char charArray[] = { 'a', 'b', 'c', 'd', 'e', 'f' };
    buffer.insert(0, charArray);

    System.out.println(buffer.toString());
    
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable