I want to know if there is any way to convert a String to Java compilable code...
For example, I have the following code:
public int calcSum(int a, int b) {
return a+b;
}
public int calcDifference(int a, int b) {
return a-b;
}
and I have:
String code = "System.out.println(this.calcSum(50, 50));\n"
+ "System.out.println(this.calcDifference(80, 40));";
after running the "code", the console display:
100
40
it is possible to do this?