Array: setLong(Object array, int index, long l) : Array « java.lang.reflect « Java by API






Array: setLong(Object array, int index, long l)

  
import java.lang.reflect.Array;

public class Main {
  public static void main(String... args) {
    Object o = new int[2];
    Array.setShort(o, 0, (short) 2); // widening, succeeds
    Array.setLong(o, 1, 2L); // narrowing, fails
  }
}

   
    
  








Related examples in the same category

1.Array: clone()
2.Array: get(Object array, int index)
3.Array: getInt(Object array, int index)
4.Array: getLength(Object array)
5.Array: newInstance(Class componentType, int length)
6.Array: newInstance(Class componentType, int... dimensions)
7.Array: set(Object array, int index, Object value)
8.Array: setInt(Object array, int index, int i)
9.Array: setShort(Object array, int index, short s)