In Java, the inner class can access private members of enclosing class. But can the outer class access private members of inner class? This is irrespective of whether inner class is static or not. I thought this is not true but the following code seems to compile and work fine.
public class Outer {
class Inner {
private int i = 0;
private Inner() {}
}
public static void main(String[] args) {
Outer o = new Outer();
Outer.Inner oi = o.new Inner();
oi.i = 10;
}
}