LongBuffer hasArray() in Java

hasArray(): This method is available in java.nio.LongBuffer class of Java.

Syntax:

boolean java.nio.LongBuffer.hasArray()

This method tells whether or not this buffer is backed by an accessible long array.

Parameters: NA

Returns: true if, and only if, this buffer is backed by an array and is not read-only.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

        LongBuffer lb = LongBuffer.wrap(array);

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

Output:

true


No comments:

Post a Comment