I essentially want a function that calls other functions. So functionToCall will call either func1 or func2, and print out some information. This can be done in C like so below, where I can pass func1 and func2 as parameters. How do I do this in Java?
public void callOtherFunctions(void * functionToCall, argument1, argument 2)
{
functinoToCall(argument1, argument2);
System.out.println("Called function success!");
}
public void func1(arg1, arg2)
{
//body
}
public void func2(arg1, arg2)
{
//body
}
Is there any "Simple" way to do this?
Edit: The recommended duplicate post is not exactly what I want. That use is implementing interfaces, whereas I want to a call a function that can call any type of functions passed to it.
i.e. I do not want to specify what function to call within my callOtherFunction body. It should be given as an argument.