Java IO Tutorial - Java LongBuffer.equals(Object ob)








Syntax

LongBuffer.equals(Object ob) has the following syntax.

public boolean equals(Object ob)

Example

In the following code shows how to use LongBuffer.equals(Object ob) method.

/*  ww w  .j av  a2s.  c o  m*/
import java.nio.LongBuffer;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);
    
    longBuffer.rewind();
    
    
    LongBuffer longBuffer2 = longBuffer.compact();
    
    System.out.println(longBuffer2.equals(longBuffer2));

  }
}

The code above generates the following result.