Array: set(Object array, int index, Object value)
import java.lang.reflect.Array;
public class Main {
public static void main(String[] argv) throws Exception {
int[] array = { 1, 2, 3 };
// Get the value of the third element.
Object o = Array.get(array, 2);
// Set the value of the third element.
Array.set(array, 2, 1);
}
}
Related examples in the same category
| 1. | Array: clone() | | |
| 2. | Array: get(Object array, int index) | | |
| 3. | Array: getInt(Object array, int index) | | |
| 4. | Array: getLength(Object array) | | |
| 5. | Array: newInstance(Class componentType, int length) | | |
| 6. | Array: newInstance(Class> componentType, int... dimensions) | | |
| 7. | Array: setInt(Object array, int index, int i) | | |
| 8. | Array: setLong(Object array, int index, long l) | | |
| 9. | Array: setShort(Object array, int index, short s) | | |