问题1
public class q1 {
public static void main(String[] args) throws Exception {
Class<Person> personClass = Person.class;
Person person = personClass.newInstance();
Constructor<Person> c = personClass.getConstructor(String.class, int.class, String.class);
Person person1 = c.newInstance();
Field[] fields = personClass.getDeclaredFields();
Field age = personClass.getDeclaredField("age");
age.setAccessible(true);
Person p = new Person();
age.set(p, 12);
Method[] methods = personClass.getMethods();
System.out.println(Arrays.toString(methods));
Method string = personClass.getMethod("toString");
System.out.println(string.invoke(new Person()));
}
}