LongBuffer mark() in Java

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

Syntax:

LongBuffer java.nio.LongBuffer.mark()

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

Parameters: NA

Returns: This buffer.

Exceptions: NA

Approach

Java

import java.nio.LongBuffer;

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

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

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

Output:

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


No comments:

Post a Comment