![]() |
VOOZH | about |
The java.lang.reflect.Array.getChar() is an inbuilt method in Java and is used to return the element present at a given index from the specified Array as a char. Syntax
Array.getChar(Object []array,int index)
Parameters :
Return Type: This method returns the element of the array as char. Note: Typecast isn't necessary as the return type is char Exception: This method throws following exception
Below programs illustrate the getChar() method of Array Class: Program 1:
GfG
Program 2:
Exception : java.lang.ArrayIndexOutOfBoundsException
Program 3:
Exception : java.lang.NullPointerException
Program 4:
Exception : java.lang.IllegalArgumentException: Argument is not an array