public static void set(Object array,
int index,
Object value)
throws IllegalArgumentException,
ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified new value. The new value is
first automatically unwrapped if the array has a primitive component type.
public static void main(String... args) { Object o = Array.newInstance(String.class, 3); for (int i = 0; i < 3; i++) { Array.set(o, i, String.valueOf(i)); } System.out.println(Arrays.toString((Object[]) o)); } }