Content received from: http://JavaFAQ.nu/java-article24.html


Q: Can I pass a function as a parameter in Java? If so, how?
Tuesday, September 24, 2002 (00:11:29)

Posted by

Question: Can I pass a function as a parameter in Java? If so, how?

Answer: No, you cannot. But you can pass an object with method and then just use this method like this:

myFunction (object); // object has method useMyMethod(){ do smth here...}
..
..
somewhere in another place use this function..

object.useMyMethod();

So you passed an Object with function which is a part of the Object Smile

It is like putting your letter into an envelop...