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. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. Timer timer;
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. Timer timer = new Timer();
  14. timer.schedule(new MyTask(3), 1000);
  15. timer.schedule(new MyTask(10), 2000);
  16. timer.schedule(new MyTask(4), 3000);
  17. }
  18. }
  19.  
  20. class MyTask extends TimerTask
  21. {
  22. private int buttonId;
  23. public MyTask(int buttonId)
  24. {
  25. super();
  26. this.buttonId = buttonId;
  27. }
  28. public void run()
  29. {
  30. System.out.println("Button ID" + buttonId);
  31. }
  32. }
Time limit exceeded #stdin #stdout 5s 320896KB
stdin
Standard input is empty
stdout
Button ID3
Button ID10
Button ID4