If I have a inner class declaration such as:
Class A {
public static class B {
}
}
followed by:
Class> impl
Inner classes i.e class B cannot exist outside the parent class. You need to construct the parent class i.e class A first.
and if you remove static from your inner class i.e for non-static inner class , you need to pass the parent class in during construction of the inner class.
Object a = Class.forName("A").newInstance(); //object of outer class
//object of inner class
Object b = implClass.getDeclaredConstructor(new Class[] { a.getClass() })
.newInstance(new Object[] { a });