Create Java method from a string?
- by drozzy
Is it possible in Java, to declare a method with a string instead of an identifier?
For example can I do something like the following:
class Car{
new Method("getFoo", {
return 1+1;
});
}
//Use it
Car car = new Car();
car.getFoo();
EDIT: I am adding a Purpose WHY I need this. In order to not hardcode method names when using…