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








Syntax

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

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

Example

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

import java.lang.reflect.Array;
// w w w.  ja  va  2s .co m
public class Main {
  public static void main (String args[]) {
    int[] array = new int[]{1,2,3};
    
   
    int value = Array.getInt(array, 1);

    System.out.println(value);

  }
}

The code above generates the following result.