Java Array.setShort(Object array, int index, short s)

Syntax

Array.setShort(Object array, int index, short s) has the following syntax.

public static void setShort(Object array,  int index,  short s)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setShort(Object array, int index, short s) method.


import java.lang.reflect.Array;
import java.util.Arrays;
//from w w  w  .ja v  a 2s.  c  o  m
public class Main {
  public static void main (String args[]) {
    short[] array = new short[]{1,2,3};
    
    Array.setShort(array, 1, (short)9);
    
    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