Java Reflection Java Java API
java.lang.reflect.Field
public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException
Sets the value of a field as a double on the specified object.
double
package com.logicbig.example.field;import java.lang.reflect.Field;public class SetDoubleExample { private double myDouble; public static void main(String... args) throws NoSuchFieldException, IllegalAccessException { Field f = SetDoubleExample.class.getDeclaredField("myDouble"); SetDoubleExample instance = new SetDoubleExample(); f.setDouble(instance, 1.1d); System.out.println(f.getDouble(instance)); }}
1.1