Class.getConstructor(Class <?>... parameterTypes) has the following syntax.
public Constructor <T> getConstructor(Class <?>... parameterTypes) throws NoSuchMethodException, SecurityException
In the following code shows how to use Class.getConstructor(Class <?>... parameterTypes) method.
//from w w w . j a v a 2 s . c o m import java.lang.reflect.Constructor; public class Main { public static void main(String[] args) throws Exception { // returns the Constructor object of the public constructor Class cls[] = new Class[] { String.class }; Constructor c = String.class.getConstructor(cls); System.out.println(c); } }
The code above generates the following result.