capacity(): This method is available in java.nio.Buffer class of Java.
Syntax:
int java.nio.Buffer.capacity()
This method returns this buffer's capacity.
Parameters: NA
Returns: The capacity of this buffer.
Exceptions: NA
Approach
Java
import java.nio.LongBuffer;public class LongBuffercapacity {public static void main(String[] args) {long array[] = { 1, 2, 3, 4 };LongBuffer lb = LongBuffer.wrap(array);System.out.println(lb.capacity());}}
Output:
4
No comments:
Post a Comment