Java IO Tutorial - Java ShortBuffer.hasArray()








Syntax

ShortBuffer.hasArray() has the following syntax.

public final boolean hasArray()

Example

In the following code shows how to use ShortBuffer.hasArray() method.

import java.nio.ShortBuffer;
/*  w w  w .  j  a va2  s  .c om*/
public class Main {
  public static void main(String[] args) {
    ShortBuffer bb = ShortBuffer.allocate(10);
    bb.put((short)100);
    System.out.println(bb.hasArray());

  }
}

The code above generates the following result.