|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
Q: Can I pass a function as a parameter in Java? If so, how?
|
JavaFAQ Home » Daily Tips

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 
It is like putting your letter into an envelop... Printer Friendly Page
Send to a Friend
Search here again if you need more info!
|
|
|