class Outer
{
private int x=3;
class Inner
{
int x=4;
void function()
{
int x=6;
System.out.println("x="+x);
System.out.println("x="+this.x);//想打印4,除了this还有没有别的写法?
}
}
void method()
{Inner in=new Inner();
in.function();}
}
class demo
{
public static void main(String[] args)
{ Outer out=new Outer();
out.method();
}
} |
|