标签:invoke span student 临时 修饰符 .net 相关 type 信息
Constructor<T> getConstructor(Class<?>... parameterTypes)
parameterTypes 是 Class[ ] ,它里面的元素和元素顺序与构造器参数对应。
Constructor<?> constructor = studentClass1.getConstructor(new Class[]{}); Student student1 = (Student)constructor.newInstance();
也可以写成constructor.newInstance(new Object[ ] { })
Constructor<?> constructor2 = studentClass1.getConstructor(new Class[]{int.class}); Student student2 = (Student)constructor2.newInstance(12);
也可以写成constructor.newInstance(new Object[ ] { 12 })
Student student3 = Student.class.newInstance();
标签:invoke span student 临时 修饰符 .net 相关 type 信息
原文地址:https://www.cnblogs.com/mibloom/p/9675351.html