public class Program {
public String str = "Hello";
public Program() {
}
public Program(String str, Date date, int i) {
this.str = str;
}
public String getStr() {
return str;
}
public void setStr(String str) {
this.str = str;
}
public static void main(String[] args) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Program program = new Program();
Class progClass = program.getClass();
Field strField = progClass.getField("str");
strField.set(program, "World");
System.out.println(program.str);
}
}