Skip to content

Instantly share code, notes, and snippets.

@miri64
Created March 21, 2013 10:34
Show Gist options
  • Save miri64/5212112 to your computer and use it in GitHub Desktop.
Save miri64/5212112 to your computer and use it in GitHub Desktop.
class Ball extends Throwable {}
class P {
P target;
P(P target) {
this.target = target;
}
void aim(Ball ball) {
try {
throw ball;
} catch (Ball b) {
target.aim(b);
}
}
public static void main(String[] args) {
P parent = new P(null);
P child = new P(parent);
parent.target = child;
parent.aim(new Ball());
}
}
@miri64
Copy link
Author

miri64 commented Mar 21, 2013

$ javac P.java && java P
have fun ;-)

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