I am trying to make a program that executes a particular method when the class name and method name are passed as String parameter to the caller. Consider the code below. I
I doubt you really need to do this. I suspect you have an XY Problem. Your question is somewhat similar to asking whether Java has an eval function and the correct answer is similar:
First ask yourself, where did these String come from? Did another part of your program generate them, or was it input provided by the user?
Another part of my program generated it: so, you want one part of your program to decide the kind of operation to perform, but not perform the operation, and a second part that performs the chosen operation. Instead of generating and then evaluating Strings, use the Strategy, Command or Builder design pattern, as appropriate for your particular case.
It is user input: the user could input anything, including class and method names that, when executed, could cause your program to misbehave, crash, expose information that should be secret, damage persistent information (such as the content of a database), and other such nastiness. The only way to prevent that would be to parse the Strings and then either immediately execute the method on a successful parse, or have the parser create a Command object for later execution.