import java.lang.reflect.Method;
 
class MethodInvokeTest {
 
    public static void main(String[] args) throws Exception {
        String str = "hello";
        Method m = str.getClass().getMethod("toUpperCase");
        System.out.println(m.invoke(str));  // HELLO
    }
}

相关文章:

  • 2022-01-02
  • 2022-12-23
  • 2021-12-27
  • 2021-12-27
  • 2022-12-23
  • 2021-09-03
  • 2022-02-18
猜你喜欢
  • 2021-11-10
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案