Access outer class from inner class: Why is it done this way?
- by Vuntic
So most of us know how to access an outer class from an inner class. Searches with those words give oodles of answered questions on that topic. But what I want to know is why the syntax is the way it is.
Example:
public class A
{
private class B
{
public void c()
{A.this.d();}
}
public void d()
{System.out.println("You've called d()! Go, you!");}
}
Why is it A.this.d()? It looks like this is a static field of class A, but... * am confused *
Forgive me if this is a repeat; like I said, searches with those words give how-answers.