java – I have code text in a String variable. Can it be done?

Question:

There is a String code; it contains the code of one method. Can it be done with some libraries or some other way? Thanks in advance!

Answer:

If you have javac on hand, you can compile it and call it by reflection. No other way.

Scroll to Top