can I put method as parameter in java?

example public void do_five( method d ){ d(); d(); d(); d(); d(); }

9/20/2019 6:18:58 PM

Book Games

3 Answers

New Answer


I don't know if it's possible, but why would you want a method for that, you could just use a for-loop 🤷‍♂️


I haven't seen this done before but i know you can use a method inside of a method and you an also return a method if that helps


one way is via reflection https://code.sololearn.com/cybCh5BLNgeF/#java