Created
April 1, 2017 05:36
-
-
Save komu/dcc1bb36141c104297e5ed7b6dea0e85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package orwell; | |
import java.lang.reflect.Field; | |
public class Room101 { | |
public static void main(String[] args) { | |
Integer result = 2 + 2; | |
System.out.printf("2 + 2 = %d\n", result); | |
room101(); | |
System.out.printf("2 + 2 = %d\n", result); | |
} | |
private static void room101() { | |
try { | |
Integer four = 4; | |
Field field = four.getClass().getDeclaredField("value"); | |
field.setAccessible(true); | |
field.set(four, 5); | |
} catch (Exception e) { | |
throw new RuntimeException(e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment