gpt4 book ai didi

java - 如何在给定名称和形式参数类型的情况下检索 Method 对象?

转载 作者:行者123 更新时间:2023-12-02 04:06:46 26 4
gpt4 key购买 nike

给定

class Foo {
public static void aa() {}
public static void bb(String x) {}
}

通话:

Foo.class.getMethod("aa")

将返回对aa的引用。

需要什么咒语才能获得对 bb 的引用?

最佳答案

Foo.class.getMethod("bb", String.class);

关于java - 如何在给定名称和形式参数类型的情况下检索 Method 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34212673/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com