InstantiationException while instantiating inner class using reflection. Why?
问题 i cant create B-Object, but why? public class AFactory { public int currentRange; private abstract class A { protected final Object range = currentRange; public int congreteRange = 28; } public class B extends A { public int congreteRange = 42; } synchronized A createNew(Class<? extends A> clazz) throws Exception { // EDIT: there is accessible default constructor currentRange = clazz.newInstance().congreteRange; return clazz.newInstance(); } public static void main(String[] args) throws