mercredi 9 novembre 2016

Calling method depending on input?

I want to be able to call different methods depending on the user input.

What I do now is store the user input in a String and check to see if it is a valid input. After that I have a switch statement that goes through all possibilities.

Is it somehow possible to use a String variable to call a method, assuming that the String has the same value as the method name?





Aucun commentaire:

Enregistrer un commentaire