So, I'm trying to figure out if there is any method to dynamically create / assign a method to a class in Java. If it were C, I would just do it this way with pointers:
public class Foo { void bar(void *ptr) {....} }; int main() { Foo f = new Foo(); f.bar({"my function" ...}) }
However, Java, of course, has no pointers, so is there a way to get similar functionality from a Java application?
source share