请在评论中帮我解决问题。我是java8的新手。如果你给我一些关键词进行搜索,那也会很棒。
public class aClass{
public Function<String,String> f;
private void doSomething(){
System.out.println("done");
}
public void addF(Function<String,String> f){
this.f = f;
}
}
public class bClass{
public String func(String str){
System.out.println(str);
//Call doSomething();
//Can I do that?
}
public static void main(String[] args){
aClass a = new aClass();
a.addF(this::func);
}
}