我正在研究有关 Java 继承的代码(来自 Hoffman 的 Core 2 java bk),这是 MethodPointerTest.java 类中的代码:
Method square = MethodPointerTest.class.getMethod("square", double.class);
稍后在课堂上有这样的功能:
public static double square(double x){
return x * x;
}
为什么 getMethod 函数的 seocnd 参数是:
double.class
VS 只是说“双倍”
谢谢你