Mark said:
It is also visible to nested/inner classes of the declaring class.
....and to any classes which enclose it.
But only in the sense that the compiler fakes access by generating non-private
backdoor access methods. That may be close enough for some purposes, but it
turns my stomach.
BTW, /inheritance/ as opposed to just /access/ is a different story. The
reader is invited to consider what the output of the following program should
be according to the spec, what it should be according to common-sense, and what
it will be according to the code generated by javac (I'm using JDK 1.6.0).
-- chris
================
public class Test
{
public static void
main(String[] args)
{
Nested n = new Nested();
n.test();
Test t = new Nested();
t.doIt();
}
private void
doIt()
{
System.out.println("Doin' it");
}
public static class Nested
extends Test
{
public void
test()
{
this.doIt();
super.doIt();
}
public void
doIt()
{
System.out.println("Not gonna do it");
}
}
}
================