fork download
  1. class Int {
  2. int val;
  3.  
  4. Int(int val) {
  5. this.val = val;
  6. }
  7. }
  8. interface Eq {
  9. public boolean check(Object a, Object b);
  10. }
  11.  
  12. class Outer {
  13. Eq foo(Int x) {
  14. x.val = 1;
  15. return new Eq() {
  16. public boolean check(Object a, Object b) {
  17. if(x.val == 0) {
  18. return a.equals(b);
  19. }
  20. return !a.equals(b);
  21. }
  22. };
  23. }
  24.  
  25. public static void main(String args[]) {
  26. Outer out = new Outer();
  27. Int x = new Int(0);
  28. Eq e = out.foo(x);
  29. System.out.println(e.check(1, 1));
  30. }
  31. }
Success #stdin #stdout 0.08s 54728KB
stdin
Standard input is empty
stdout
false