Java Reflection - Java Array.setDouble(Object array, int index, double d)








Syntax

Array.setDouble(Object array, int index, double d) has the following syntax.

public static void setDouble(Object array,  int index,  double d)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setDouble(Object array, int index, double d) method.

/*www.  j av a  2 s .c  o  m*/
import java.lang.reflect.Array;
import java.util.Arrays;

public class Main {
  public static void main (String args[]) {
    double[] array = new double[]{1,2,3};
    
    Array.setDouble(array, 1, (double)1);
    
    System.out.println(Arrays.toString(array));


  }
}

The code above generates the following result.