import java.lang.reflect.Field;
public class Test {
public static void main(String[] args) throws Exception {
doStuff();
System.out.println("Hello".equals("World")); // --> true
}
public static void doStuff() throws Exception {
Field value = String.class.getDeclaredField("value");
value.setAccessible(true);
value.set("Hello", "World".toCharArray());
}
}
http://www.javaspecialists.eu/talks/oslo09/ReflectionMadness.pdf
1 comment:
Same with
value.set("true", "false".toCharArray());
is way more destructive :)
Post a Comment