fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class NoVisibility {
  8. private static boolean ready;
  9. private static int number;
  10. private static class ReaderThread extends Thread {
  11. public void run() {
  12. while (!ready);
  13. System.out.println(number);
  14. }
  15. }
  16. public static void main(String[] args) throws InterruptedException {
  17. new ReaderThread().start();
  18. Thread.sleep(1000);
  19. number = 42;
  20. ready = true;
  21. }
  22. }
Time limit exceeded #stdin #stdout 5s 28244KB
stdin
Standard input is empty
stdout
Standard output is empty