Here you can find the source of newInstance(Constructor> constructor, Object... arguments)
Parameter | Description |
---|---|
constructor | a parameter |
arguments | a parameter |
public static Object newInstance(Constructor<?> constructor, Object... arguments)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { /**/*from w w w . j a v a2 s .c om*/ * Fail-safe. * @param constructor * @param arguments * @return null on errors. */ public static Object newInstance(Constructor<?> constructor, Object... arguments) { try { return constructor.newInstance(arguments); } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { } catch (InvocationTargetException e) { } return null; } }