Originally posted by anil kumar:
Hi
Chandra
Ya i have shadowed the variable ,i know ,but i am asking is there any way to get that value in the method.
Nay Anil,
You are only able to access:
1- The enclosing class,
2- innerclass instance variables
Because you have "this" reference.
Topclass.this.varname; (for first case)
this.varname (for second case)
3- When you write simply "a" from the instance method, this can first be local variable defined inside the method or the member variable.
4- If you write "a" in static context (from static method or block),
it can first be local variable as always or the class variable (declared static)
There are no way to access variable that is defined inside a method and
you shadow it inside the methodlocal inner class. You think yourself, how can you reach to that. No way!