java - How to access outer class variable of same name? -


i have made outer , inner class. both these classes have variable int x. how access x of outer class in inner class. this.x not working.

class outerclass { int x,y; private class innerclass {     private void printsum(int x,int y) {         this.x=x;         this.y=y;     }   } } 

you can try :

   private void printsum(int x,int y) {        outerclass.this.x=x;        outerclass.this.y=y;     }