IntBuffer mark() in Java

mark(): This method is available in java.nio.IntBuffer class of Java.

Syntax:

IntBuffer java.nio.IntBuffer.mark()

This method sets this buffer's mark at its position.

Parameters: NA

Returns: This buffer.

Exceptions: NA

Approach

Java

import java.nio.IntBuffer;

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

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

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

Output:

java.nio.HeapIntBuffer[pos=0 lim=5 cap=5]


No comments:

Post a Comment