Java Array.setInt(Object array, int index, int i)

Syntax

Array.setInt(Object array, int index, int i) has the following syntax.

public static void setInt(Object array,  int index,  int i)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setInt(Object array, int index, int i) method.


import java.lang.reflect.Array;
import java.util.Arrays;
//from   w  w  w. j  a  va 2s  .  c  om
public class Main {
  public static void main (String args[]) {
    int[] array = new int[]{1,2,3};
    
    Array.setInt(array, 1, 100);
    
    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