IntBuffer limit() in Java

limit(): This method is available in java.nio.Buffer class of Java.

Syntax:

int java.nio.Buffer.limit()

This method returns this buffer's limit.

Parameters: NA

Returns: The limit of this buffer.

Exceptions: NA

Approach

Java

import java.nio.IntBuffer;

public class IntBufferlimit {
    public static void main(String[] args) {

        int array[] = { 1, 2, 3, 4 };
        IntBuffer lb = IntBuffer.wrap(array);

        System.out.println(lb.limit());
    }
}

Output:

4


limit(int)


No comments:

Post a Comment