import java.lang.reflect.*;
class ReflectTest
{
public static void main(String[] args) throws Exception
{
String str="abc";
Class cls1=str.getClass();
Class cls2=String.class;
Class cls3=Class.forName("java.lang.String");
Constructor constructor1=String.class.getConstructor(StringBuffer.class);
String str2=(String)constructor1.newInstance(new StringBuffer("abc"));
System.out.println(str2.chatAt(1));
}
}提示的错是
file:///C:\Users\Administrator\AppData\Roaming\Tencent\Users\303267617\QQ\WinTemp\RichOle\P5G8S@Y`U`@RDR019H4`0TV.png
大神们帮忙看看那里出错了
|
|