mardi 29 septembre 2015

Methods in Arrays for Java? Reflection?

I'm using Java, and wondering if it's possible to put methods directly into arrays as elements. Something like:

...[] arrayName = {herp(), derp(), jinkies()};

When I looked this up prior, some people mentioned "reflection," but I don't know what this is (I'm very new to programming). Is there a simple way to put methods into arrays (my goal is to spit them out randomly with a Random, and eventually terminate with a String parameter in each method named "quit" or something)? If not, how does reflection work for this circumstance (if at all)?

Thank you for your time.

[EDIT] I am NOT only asking what reflection is. My exact (main) question is "Is it possible to put methods into arrays," and if it is, how is that done? What is the syntax for it?





Aucun commentaire:

Enregistrer un commentaire