Java IO Tutorial - Java CharBuffer.wrap(CharSequence csq)








Syntax

CharBuffer.wrap(CharSequence csq) has the following syntax.

public static CharBuffer wrap(CharSequence csq)

Example

In the following code shows how to use CharBuffer.wrap(CharSequence csq) method.

import java.nio.CharBuffer;
// w  ww .jav  a  2s.co m
public class Main {
  public static void main(String[] args) {
    CharBuffer cb1 = CharBuffer.wrap("java2s.com");
    System.out.println(cb1.toString());
   

  }
}

The code above generates the following result.