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








Syntax

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

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

Example

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

/*from   w w w .j  a v a  2 s  .  c  om*/
import java.lang.reflect.Array;

public class Main {
  public static void main (String args[]) {
    char[] array = new char[]{'a','b','c'};
    
   
    char value = Array.getChar(array, 1);

    System.out.println(value);

  }
}

The code above generates the following result.