Java IO Tutorial - 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.

/*  w  w w.  ja  v a2s .c  om*/
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.