class Person {
String name;
Person(String name) {
this.name = name;
}
}
public class Reflect {
public static void main(String[] args) throws ClassNotFoundException, Exception, Exception {
Class clazz = Class.forName("reflect.Person");
Constructor constructor = clazz.getConstructor(String.class);
}
}
Exception in thread "main" java.lang.NoSuchMethodException: reflect.Person.<init>(java.lang.String)
at java.lang.Class.getConstructor0(Class.java:3069)
at java.lang.Class.getConstructor(Class.java:1812)
at reflect.Reflect.main(Reflect.java:14)