I want to know if we can do something like this in java. Say I have a class with some members:
Class Test {
// some constructors and members
public Object func;
}
and then I have some functions defined from some other classes. I want to assign these functions to my Test class at runtime so that depending on the situation, eval(test.func) could be any function. How would you do that? It is rather easily done in javascript though, to pass around functions as string.
Is reflection or closure related to what I want to achieve? Thank you