[kaffe] Java lang spec: private access
Ito Kazumitsu
kaz at maczuka.gcd.org
Tue May 16 09:20:37 PDT 2006
From: "Stuart Ballard" <stuart.a.ballard at gmail.com>
Date: Tue, 16 May 2006 10:08:36 -0400
> Because inner classes *are* within the body of the top level class, perhaps? :)
Yes, in the following example, the private member of the inner class is
accessible to the top level class.
public class ZZ {
public class ZZ1 {
private int a;
}
ZZ1 zz1;
public ZZ() {
zz1 = new ZZ1();
zz1.a = 1;
}
}
But the following cannot be compiled because "a" in type "ZZ$ZZ1" is
not accessible. Isn't this an access from within the top level class?
public class ZZ {
public class ZZ1 {
private int a;
public void foo() {}
}
ZZ1 zz1;
public ZZ() {
zz1 = new ZZ1() {
public void foo() {
a = 1;
}
};
}
}
More information about the kaffe
mailing list