I thought of sharing this:
public class
Testing {
private static void main (
String args[]) {
new A().new B();
}
}
class A {
private int i = 5;
class B extends A {
{
System.out.println(i); /// 1
}
}
}
I didn't know what to expect. The options were:
1) Ambigious reference to i at line marked 1
2) Can't access private member of super class
3) Enclosing class is more respeced than being a
super class.
Try it out. Option 3 is correct and any thoughts
would be appreciated.