Skip to content

Instantly share code, notes, and snippets.

@thypon
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thypon/98b87bac86cc566bf888 to your computer and use it in GitHub Desktop.
Save thypon/98b87bac86cc566bf888 to your computer and use it in GitHub Desktop.
May be alive
class Shrodinger {
static int DEAD = 0;
static int ALIVE = 1;
int status;
}
class Main {
stativ void main() {
Shrodinger cat = new Shrodinger();
cat.status = Shrodinger.DEAD;
try {
new Thread(() => cat.status = Shrodinger.ALIVE);
if (Shrodinger.ALIVE) {
println("The cat is alive");
} else {
println("The cat is dead");
}
catch (ThreadException te) {
println("The cat is neither alive or dead");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment