• 2022-05-29
    9.82 若已执行语句Class<;?>; p1=Student.class,其中Student定义了两个构造方法:Student(){}; Student(int stuNo){},则下面通过p1 来获取Student类对象的语句中,错误的是( )
    A: Object s1 = p1.newInstance();
    B: Student s1 = p1.newInstance();
    C: Constructor<;?>; cons = p1.getConstructor( new Class[]{int.class});Object obj1 = cons.newInstance(new Object[]{1});
    D: Constructor<;?>; cons = p1.getConstructor( int.class);Object obj1 = cons.newInstance(1);
  • 举一反三