public class Outer
{
int Age;
}
public class Wrapper
{
private int Age = 10;
public Wrapper()
{
final int Age = 20;//need access
class Inner extends Outer
{
private int Age = 30;
public Inner()
{
System.out.println("Wrapper Age = " + Wrapper.this.Age);
System.out.println("Wrapper Construct Age = " + ???.Age);//the variable name
System.out.println("Inner Age = " + Age);
System.out.println("Outer Age = " + super.Age);
}
}
Inner myInner = new Inner();
}
public static void main(
String[] args)
{
Wrapper myApp = new Wrapper();
}
}
If there are four variables with the same name but in a different location, how do I access to the Age in the Wrapper Constructor? Thanks!