can I put method as parameter in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can I put method as parameter in java?

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

20th Sep 2019, 6:18 PM
Khaled Abd Al-hamead Hawwas
Khaled Abd Al-hamead Hawwas - avatar
3 Answers
+ 1
I don't know if it's possible, but why would you want a method for that, you could just use a for-loop 🤷‍♂️
20th Sep 2019, 6:59 PM
Anton Böhler
Anton Böhler - avatar
0
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
20th Sep 2019, 7:46 PM
D_Stark
D_Stark - avatar
22nd Sep 2019, 8:24 PM
zemiak