Last active
August 4, 2016 04:06
-
-
Save sshark/3084558 to your computer and use it in GitHub Desktop.
What is wrong with this class?
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
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