通过反射创建对象的几种方式
public static void main(String args []) throws Exception {
Class catcls = Class.forName("FirstZjc.cat");
Object o = catcls.newInstance();
System.out.println(o);
Constructor constructor1 = catcls.getConstructor(String.class);
Object jack = constructor1.newInstance("jack");
System.out.println(jack);
Constructor declaredConstructor1 = catcls.getDeclaredConstructor(String.class, int.class);
declaredConstructor1.setAccessible(true);
Object zjc = declaredConstructor1.newInstance("zjc", 22);
System.out.println(zjc);