Get the capacity of a buffer
In this tutorial you will learn about how get the capacity of a buffer
In this tutorial you will learn about how get the capacity of a buffer
Get the capacity of a buffer
In this tutorial we will see how to get size of buffer using
capacity() method
.
Code:
import java.nio.CharBuffer;
public class CharBufferCapacityDemo {
public static void main(String[] args) {
CharBuffer charbuffer1 = CharBuffer.allocate(6);
charbuffer1.put('B').put('U').put('F').put('F').put('E').put('R');
System.out.println(charbuffer1.capacity());
}
}
|
Output:
Download this code