Hi All,
In the below code why "this.var" and "super.var" both printing the value in Base class? Please explain me whats happening here. What is "this" refers here?
class Base
{
int var=10;
}
class Outer
{
public void method()
{
class Inner extends Base
{
public void local_method()
{
int var=100;
System.out.println(var);
System.out.println(this.var);
System.out.println(super.var);
}
}
Inner i=new Inner();
i.local_method();
}
}
class Other
{
public static void main(
String[] args)
{
new Outer().method();
}
}
Thanks in advance!
Regards,
Surekha.