I think you are always going to get "A var"
.
This is because your test()
method implementation is being defined on an anonymous subclass of A
. I don't think you can access the B.var
instance variable within your test()
method unless you explicitly refer to the outer class using ClassB.this.var
.