Java CharBuffer.toString()
Syntax
CharBuffer.toString() has the following syntax.
public String toString()
Example
In the following code shows how to use CharBuffer.toString() method.
/*from w ww. j a v a 2 s.co m*/
import java.nio.CharBuffer;
public class Main {
public static void main(String[] args) {
CharBuffer cb1 = CharBuffer.allocate(50);
cb1.append("java2s.com");
cb1.rewind();
System.out.println(cb1.toString());
}
}
The code above generates the following result.