Java CharBuffer.put(int index, char c)
Syntax
CharBuffer.put(int index, char c) has the following syntax.
public abstract CharBuffer put(int index, char c)
Example
In the following code shows how to use CharBuffer.put(int index, char c) method.
import java.nio.CharBuffer;
/*from www. j a v a 2 s . com*/
public class Main {
public static void main(String[] args) {
CharBuffer cb1 = CharBuffer.allocate(5);
cb1.put(2,'j');
cb1.rewind();
System.out.println(cb1.toString());
}
}
The code above generates the following result.