import java.util.concurrent.Callable;
public class Main {
// Generic method that accepts a Callable and executes it
public static <T> T control(Callable<T> f) throws Exception {
return f.call();
}
public static String say() {
return "abcd";
}
public static void main(String[] args) {
try {
// Using a method reference
String result = control(Main::say);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/*
run:
abcd
*/