Added 10 more gists.

This commit is contained in:
Miguel Astor
2023-06-20 22:03:49 -04:00
parent 1400a87eab
commit 22ff5bfa25
19 changed files with 1642 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
class Ball extends Throwable { }
class P {
private String name;
private P target;
P(String name, P target) {
this.name = name;
this.target = target;
}
public String getName() {
return name;
}
public void setTarget(P target) {
this.target = target;
}
public void aim(Ball ball) {
try {
System.out.println(target.getName() + ", catch!");
throw ball;
} catch (Ball b) {
target.aim(ball);
}
}
}
public class PlayBall {
public static void main(String args[]) {
P parent = new P("Dad", null);
P child = new P("Son", parent);
parent.setTarget(child);
parent.aim(new Ball());
}
}

1
PlayBall.java/README.md Normal file
View File

@@ -0,0 +1 @@
[https://xkcd.com/1188/](https://xkcd.com/1188/)