I found this construct in some code.
Is there any benefit to have a private static class implement A? This reminded me of the Pimpl idiom in C++. Is there any benefit to using the Pimpl idiom in Java?
public abstract class A {
public void doStuff();
public static A getNewInstance() {
return new AImpl();
}
private static class AImpl extends A {
public void doStuff() {
....
}
}
}