Code example for InvocationTargetException

Methods: getCause

0
    public T newInstance(Object[] args) throws Throwable {
        constructor.setAccessible(true);
        try { 
            return constructor.newInstance(args);
        } catch (InvocationTargetException e) {
            throw e.getCause();
        } 
    } 
 
    @Override 
    public String toString() {
        return constructor.toString();
    } 
} 
Experience pair programming with AI  Get Codota for Java