import java.lang.reflect.Method;
public class ReflectTest
{
public static void main(String[] args) throws Exception
{
Method methodCharAt=String.class.getMethod("charAt",int.class);
System.out.println(methodCharAt.invoke("abc",1));
}
}
运行结果如下: