Java CharBuffer.wrap(char[] array)

Syntax

CharBuffer.wrap(char[] array) has the following syntax.

public static CharBuffer wrap(char[] array)

Example

In the following code shows how to use CharBuffer.wrap(char[] array) method.


//from   ww  w .  j  av  a  2  s .c  o m
import java.nio.CharBuffer;

public class Main {
  public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.wrap(new char[]{'j',});
    System.out.println(cb1.toString());
   

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer