Java Array.setFloat(Object array, int index, float f)

Syntax

Array.setFloat(Object array, int index, float f) has the following syntax.

public static void setFloat(Object array,  int index,  float f)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setFloat(Object array, int index, float f) method.


/*from  ww w  . j a v a2  s .com*/
import java.lang.reflect.Array;
import java.util.Arrays;

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


  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang.reflect »




Array
Constructor
Field
Method
Modifier
ParameterizedType
TypeVariable