IntBuffer hasRemaining() in Java

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

Syntax:

boolean java.nio.Buffer.hasRemaining()

This method tells whether there are any elements between the current position and the limit.

Parameters: NA

Returns: true if, and only if, there is at least one element remaining in this buffer.

Exceptions: NA

Approach

Java

import java.nio.IntBuffer;

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

        int array[] = { 1, 2, 3, 4 };

        IntBuffer lb = IntBuffer.wrap(array);

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

Output:

true


No comments:

Post a Comment