title: Dynamic Function Creation in Java
body: <p>So I'm trying to figure out if there is some method to dynamically create/assign a method to a class in Java. If it were C, I would just do it as follows using pointers:</p>
  
  <pre><code>public class Foo {  
  
    void bar(void *ptr) {....}  
  
  };  
  
  int main() {  
    Foo f = new Foo();  
    f.bar({"my function" ...})  
  }  
  </code></pre>
  
  <p>However, Java of course has no pointers, so is there any way to get a similar functionality out of a Java application?</p>