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








Syntax

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

public static long getLong(Object array,  int index)   
            throws IllegalArgumentException ,    
                   ArrayIndexOutOfBoundsException

Example

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

import java.lang.reflect.Array;
/*  w w w  . j ava2  s.c o  m*/
public class Main {
  public static void main (String args[]) {
    long[] array = new long[]{1L,2L,3L};
    
   
    long value = Array.getLong(array, 1);

    System.out.println(value);

  }
}

The code above generates the following result.