Class getConstructor() method in Java with Examples
Last Updated :
16 Dec, 2019
The getConstructor() method of java.lang.Class class is used to get the specified constructor of this class with the specified parameter type, which is the constructor that is public and its members. The method returns the specified constructor of this class in the form of Constructor object.
Syntax:
public Constructor<T>
getConstructor(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: