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








Syntax

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

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

Example

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

/*w w w  .ja  v a2  s .c o  m*/
import java.lang.reflect.Array;

public class Main {
  public static void main (String args[]) {
    boolean[] array = new boolean[]{true,true,true};
    
   
    boolean value = Array.getBoolean(array, 1);

    System.out.println(value);

  }
}

The code above generates the following result.