I don't know exactly how to define my doubt so please be patient if the question has already been asked.
Let's say I have to dynamically instantiate an object. This object will surely be instance of a subclass of a known, immutable class A. I can dynamically obtain the specific implementation class.
Would it be better to use reflection exactly as if I didn't know anything about the target class, or would it be preferrable/possible to do something like:
A obj = (Class.forName("com.package.Sub-A")) new A();
where Sub-A extends A
? The purpose would be to avoid reflection overhead times...