Code example for InvocationTargetException

Methods: getTargetException

0
		Object result;
		try { 
			System.out.println(args[0] + " entering " + zoo.getName() + ", need a ticket!");
			result = method.invoke(zoo, args);
		} catch (InvocationTargetException e) {
			throw e.getTargetException();
		} catch (Exception e) {
			throw new RuntimeException("unexpected invocation exception: "
					+ e.getMessage());
		} finally { 
			System.out.println(args[0] + " leaving " + zoo.getName() + ", see you!");
		} 
		return result;
	} 
 
}