Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. class A {
  4. static B b;
  5. static class B {
  6. int x;
  7. B(int x) {
  8. this.x = x;
  9. }
  10. }
  11. public static void main(String[] args) {
  12. new Thread() {
  13. void f(B q) {
  14. if (q.x != 1) {
  15. System.out.println(q.x);
  16. System.exit(1);
  17. }
  18. }
  19. @Override
  20. public void run() {
  21. while (b == null);
  22. while (true) f(b);
  23. }
  24. }.start();
  25. for (int x = 0;;x++)
  26. b = new B(Math.max(x%2,1));
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement