Skip to content

Instantly share code, notes, and snippets.

@sshark
Last active August 4, 2016 04:06
Show Gist options
  • Save sshark/3084558 to your computer and use it in GitHub Desktop.
Save sshark/3084558 to your computer and use it in GitHub Desktop.
What is wrong with this class?
public class AreYouDone {
private boolean done = false;
public void done() {
done = true;
}
public boolean isDone() {
return done;
}
public static void main(String[] args) throws Exception {
final AreYouDone areYouDone = new AreYouDone();
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1500);
}
catch (InterruptedException e) {
e.printStackTrace();
}
areYouDone.done();
}
}).start();
while (!areYouDone.isDone()) {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment