Atom Feed SITE FEED   ADD TO GOOGLE READER

Java Minutiae - Instantiating inner classes

Pop quiz - without reflection, access to private members, or changing the source, create an instance of Inner.
public final class Outer {
public static final Outer INSTANCE = new Outer();
private Outer() { }
public class Inner { }
}

Note that Inner is non-static, so each Inner has a reference to its containing Outer.

Show Answer
Outer.INSTANCE.new Inner()