Edit an object's methods after they've been created in Java
In JavaScript one can create and edit an object's functions on the fly. Is
this possible with a Java object's methods? I am essentially wanting
something like this:
public class MyObject{
private int x;
public MyObject(){x = 0;}
public myMethod(){}
}
MyObject foo = new MyObject();
and later call something along the lines of:
foo.myMethod = new method({x = 42;});
No comments:
Post a Comment