class Person{
private String name;
private int age;
public Person(String name,int age){
this.name=name;
this.age=age;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public class reflect {
public static void main(String[] args) throws Exception {
Constructor<;Person> cons = Person.class.getConstructor(String.class,int.class);
Person p1=(Person)cons.newInstance("lisi",13);//获取实例
System.out.println(p1.getName()+":"+p1.getAge());