IntBuffer 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.IntBuffer;

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

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

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

Output:

false


No comments:

Post a Comment