class Bag { | |
Integer x; | |
Integer y; | |
} | |
class Foo { | |
public static void foo() { | |
Bag b = new Bag(); | |
System.out.println(new Inner(b).invoke().x); | |
System.out.println(new Inner(b).invoke().x); | |
} | |
private static class Inner { | |
private Bag b; | |
public Inner(Bag b) { | |
this.b = b; | |
} | |
public Bag invoke() { | |
return b; | |
} | |
} | |
} |