Python has an exec () method, is there such a thing in Java?
2 answers
No, python is an interpreted programming language, unlike java. In other words, in order to run the java code, you first need to compile it.
- 2And let me ask you what prevents exec from compiling code on the fly? Especially Python exec does just that (bytecode is interpreted, not the source code). - andreymal
|
From the question it is not clear why working with java in interpretation mode.
Read about JavaCompiler . In certain cases it may help.
|
eval(), but most likely you can find better approaches for solving a specific task (in other words, this is the XY problem most likely ) - jfs