用户不能调用构造方法,只能通过new关键字自动调用。()
A.正确
B.错误
package com.niuke;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
public class test{
String str=new String("hello");
char[]ch={'a','b'};
public static void main(String args[]) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException{
test t = (test) Class.forName("com.niuke.test").newInstance();
Constructor<test> c = test.class.getConstructor();
test t1 = c.newInstance();
System.out.println(t+" "+t1);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='c';
}
}