LongBuffer isReadOnly() in Java

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

Syntax:

boolean java.nio.Buffer.isReadOnly()

This method tells whether or not this buffer is read-only.

Parameters: NA

Returns: true if, and only if, this buffer is read-only.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

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

Output:

false


No comments:

Post a Comment