Is there a way I can pass one of the 3 functions fun1
to fun3
as argument to eval
and then evaluate it? The code:
public class Pruebas {
public static double fun1(double x){
return x*1;
}
public static double fun2(double x){
return x*2;
}
public static double fun3(double x){
return x*3;
}
public static double eval(funx,double x0){
/* funx at this point i expect it to be fun1, fun2 or fun3 */
double f=funx(x0);
return f;
}
}