LongBuffer hasRemaining() in Java

hasRemaining(): This method is available in java.nio.LongBuffer 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.LongBuffer;

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

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

        LongBuffer lb = LongBuffer.wrap(array);

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

Output:

true


No comments:

Post a Comment