This is not necessarily the case. You did not show a class declaration for Inner. If Inner has a field called outerInt, then it will be changed. Otherwise, Outer outerInt will be. If you run:
public class Outer { int outerInt = 0; public void hello() { Inner inner = new Inner() { @Override public void execute() { outerInt = 5; } };
You will get 0, not 5.
But by commenting outInIn in the Inner, you get 5
source share