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