Java / Object, Class and Package
Why is Class.newInstance() is discouraged to use?
This method propagates any exception thrown by the nullary constructor (parameter-less), including checked exceptions. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler.
The Constructor.newInstance method avoids this problem by wrapping any exception thrown by the constructor in a (checked) InvocationTargetException.
More Related questions...