Skip to content

Instantly share code, notes, and snippets.

@rtoal
Created January 8, 2014 02:10
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtoal/8310544 to your computer and use it in GitHub Desktop.
Save rtoal/8310544 to your computer and use it in GitHub Desktop.
Uses reflection to count like King Arthur with the Holy Hand Grenade
import java.lang.reflect.Field;
public class MontyPython {
public static void main(String[] args) throws Exception {
Field v = Integer.class.getDeclaredField("value");
v.setAccessible(true);
v.set(3,5);
System.out.printf("Ready the holy hand grenade!\n");
Thread.sleep(1000);
System.out.printf("%d\n", 1);
Thread.sleep(1000);
System.out.printf("%d\n", 2);
Thread.sleep(1000);
System.out.printf("%d\n", 3);
}
}
@gencube
Copy link

gencube commented Aug 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment