![]() |
VOOZH | about |
The java.lang.reflect.Array.setByte() is an inbuilt method in Java and is used to set a specified byte value to a specified index of a given object array. Syntax:
Array.setByte(Object []array, int index, byte value)
Parameter: This method takes 3 parameters:
Exception: This method throws following exceptions:
Below programs illustrate the Array.setByte() method: Program 1:
Program 2: To demonstrate java.lang.NullPointerException
Exception : java.lang.NullPointerException
Program 3: To demonstrate java.lang.ArrayIndexOutOfBoundsException
Exception : java.lang.ArrayIndexOutOfBoundsException
Program 4: To demonstrate java.lang.IllegalArgumentException
Exception : java.lang.IllegalArgumentException: Argument is not an array