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








Syntax

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

public boolean equals(Object ob)

Example

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

//from ww  w  .j  a v  a  2 s .c  o m
import java.nio.DoubleBuffer;
import java.util.Arrays;

public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);
    
    DoubleBuffer bb1 = bb.compact();
    
    System.out.println(Arrays.toString(bb1.array()));

    System.out.println(bb.equals(bb1));
    
  }
}

The code above generates the following result.