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.  
  8. class A implements Runnable
  9. {
  10. int i = 0;
  11. public synchronized void out()
  12. {
  13. while(true)
  14. {
  15. System.out.printf("haha");
  16. try
  17. {
  18. Thread.sleep(1000);
  19. }
  20. catch(Exception e)
  21. {
  22.  
  23. }
  24.  
  25. }
  26. }
  27. public synchronized void run()
  28. {
  29. while(true)
  30. {
  31. try
  32. {
  33. Thread.sleep(100);
  34. }
  35. catch(Exception e)
  36. {
  37.  
  38. }
  39. System.out.printf("%d",i++);
  40. }
  41. }
  42. }
  43.  
  44.  
  45. /* Name of the class has to be "Main" only if the class is public. */
  46. class Ideone
  47. {
  48. public static void main (String[] args) throws java.lang.Exception
  49. {
  50. A aa1 = new A();
  51. Thread t1 = new Thread(aa1);
  52. t1.start();
  53. t1.setPriority(Thread.NORM_PRIORITY - 4);
  54. aa1.out();
  55. }
  56. }
Time limit exceeded #stdin #stdout 5s 320576KB
stdin
Standard input is empty
stdout
hahahahahahahahahahahahahahahahahahahahahaha