Java Reflection Java Java API
Class:
java.lang.reflect.Array
Method:
public static void setShort(Object array,
int index,
short s)
throws IllegalArgumentException,
ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified
short
value.
Examples
 package com.logicbig.example.array;
import java.lang.reflect.Array; import java.util.Arrays;
public class SetShortExample {
public static void main(String... args) { Object o = Array.newInstance(short.class, 3); for (int i = 0; i < 3; i++) { Array.setShort(o, i, (short) (i * 3)); } System.out.println(Arrays.toString((short[]) o)); } }
Output[0, 3, 6]
|
|