Class getDeclaredConstructor() method in Java with Examples

The getDeclaredConstructor() method of java.lang.Class class is used to get the specified constructor of this class with the specified parameter type. The method returns the specified constructor of this class in the form of Constructor object.

Syntax:

public Constructor<T>
       getDeclaredConstructor(Class[] parameterType)
       throws NoSuchMethodException, SecurityException

Parameter: This constructor accepts a parameters parameterType which is the array of parameter type for the specified constructor.

Return Value: This method returns the specified constructor of this class in the form of Constructor objects.

Exception This method throws: