fork(4) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static int x = 0;
  11.  
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. new Thread(() -> {
  15. try {
  16. Thread.sleep(1000);
  17. } catch (InterruptedException ex) { }
  18. x = 1;
  19. }).start();
  20.  
  21. while (foo());
  22. System.out.println("Done");
  23. }
  24.  
  25. static boolean foo() {
  26. return x == 0;
  27. }
  28. }
Time limit exceeded #stdin #stdout 5s 33280KB
stdin
1
2
10
42
11
stdout
Standard output is empty