public void setShort(Object obj,
short s)
throws IllegalArgumentException,
IllegalAccessException
Sets the value of a field as a short on the specified object.
Examples
package com.logicbig.example.field;
import java.lang.reflect.Field;
public class SetShortExample { private short myShort;
public static void main(String... args) throws NoSuchFieldException, IllegalAccessException { Field f = SetShortExample.class.getDeclaredField("myShort"); SetShortExample instance = new SetShortExample(); short s = 5; f.setShort(instance, s); System.out.println(f.getShort(instance)); } }