hello everyone
class Outer
{
class Inner
{
{
//this.display();
display();
}
}
void display()
{
System.out.println("Outer.display()");
}
}
here if I'm calling any method of outer class from inner class without using "this" then as inner object has reference to outer object so its able to access the outer class fields and methods.
but if i'm calling any outer class method or field using "this" then its compilation error that it can't find the method or field.why??
this is a reference to Outer$Inner object so it should have the reference to Outer object so it should have accessed Outer class members.
therefore my question is why in case of inner class this.display() is different from display(); ???
kindly answer soon.
thanks in advance.