Accessing shadowed members of an enclosing class

B

Bernd Fuhrmann

Hi!

I was just wondering if it is possible to access shadowed variables from
within an inner class. Example:

public class Outer {
public int a;//#1
public class Inner {
public int a;//#2
public void dosth() {
System.out.println("a from inner is "+a);
// Is there any way to access a from Outer
// within this context?
}
}
}

Is there any way to access the member a of Outer within Inner?

Thanks in advance,
Bernd Fuhrmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top