I want to call a method whose name (with or without parentheses and parameters) is stored in a string variable and call this method using this variable.
Until now I have found that in Java if you do this:
String str = "func();";
System.out.println(str);
This would call method func()
. But I don't think this is recommended.
So, my question is:
Is it okay to do this?
Is there any other way to do this?
Thanks.