fork 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 class Player implements Runnable {
  11. private Integer i = null;
  12. public void run() {
  13. try {
  14. Thread.sleep(1000);
  15. } catch (InterruptedException e) {
  16. System.err.println("Thread interrupted");
  17. }
  18. i = 1;
  19. }
  20. public Integer getI() {
  21. return i;
  22. }
  23. }
  24.  
  25. public static void main (String[] args) throws java.lang.Exception
  26. {
  27. Player player = new Player();
  28. Thread thread = new Thread(player);
  29. thread.start();
  30. thread.join();
  31. System.out.println(player.getI());
  32. }
  33. }
Success #stdin #stdout 0.08s 53080KB
stdin
Standard input is empty
stdout
1