If I have
[EDIT: added the type definition for "Inner"]
interface Inner{
public void execute();
}
class Outer{
int outerInt;
public void hello(){
Inner inner = new Inner(){
public void execute(){
outerInt=5;
}
}
//later
inner.execute();
}
}
will the call to inner.execute() set the outerInt variable of that particular Outer object to 5, wherever it is called from, and for as long as that Inner object exists? Or will it just change a copy of the outerInt variable and not affect the original Outer object?
This will capture and modify the outer this.
See the spec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With