Java Reflection - Java Array.getShort(Object array, int index)








Syntax

Array.getShort(Object array, int index) has the following syntax.

public static short getShort(Object array,  int index)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.getShort(Object array, int index) method.

/* w  w w.  j a va 2  s  .  com*/
import java.lang.reflect.Array;

public class Main {
  public static void main (String args[]) {
    short[] array = new short[]{1,2,3};
    
   
    short value = Array.getShort(array, 1);

    System.out.println(value);

  }
}

The code above generates the following result.