Created
March 21, 2013 10:34
-
-
Save miri64/5212112 to your computer and use it in GitHub Desktop.
This file contains 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
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()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ javac P.java && java P
have fun ;-)