Yes you can access variable x with value 1.
Here A is your outer class and B is your non-static inner class.
To access variable x of outer class A, you can do something like this
class B {
int x = 2;
void func(int x) {
System.out.print(A.this.x +" and "+x);
}
}
source
to share