samedi 23 avril 2016

Is there a way to pass a method as a parameter to a method?

I'm writing a program and I want to know if I can pass a method as a parameter of another method. For example, something of the following:

public boolean update(Method m){ //input is a method
    int i = m.execute();
    // logic relating to the value of i
}

I want to know if I can do this in java. I'm currently reading about functional programming and Reflection right now.





Aucun commentaire:

Enregistrer un commentaire