https://blog.youkuaiyun.com/qq_32719221/article/details/108481799
java 中 如何将“一个类的方法 ”作为参数传到“另一个类的方法”
在C++中通过指针调用即可,在Java中使用方法接口
方式一 方法接口
a 先定义一个接口(定义抽象方法,理解成函数参数的规范)
public interface MethodInterface {
//这个方法假如就是你想要传递的方法
public String test(String s);
}
b 不同函数实现接口(具体的函数参数)
public class Method implements MethodInterface {
@Override
public String test(String s) {
return s;
}
}
public class Method1 implements