java反射之成员方法的反射
程序员文章站
2024-01-25 19:58:10
...
public class ReflectTest{
public static void main(String[] args) throws Exception {
String str1 = "abc";
Method methodCharAt = String.class.getMethod("charAt", int.class);
System.out.println(methodCharAt.invoke(str1, 1));//b
}
}
转载于:https://my.oschina.net/projerry/blog/515936