Click to See Complete Forum and Search --> : Assigning methods at runtime?


Brad Cadle
January 26th, 1999, 10:41 PM
Hi All,

Hi all. I am a begining java programmer. This is an extension on a previous message I posted under a different header. See the subject

"User supplied methods in classes" for specifically what I am trying to accomplish.


Basically I want to if there is a way to implement a specific method at runtime. In other words, I want to have essentailly an abstract method, but implement the abstract method at runtime without having to derive a new class from it. Is this possible and what is the best way to accomplish this.


-Brad

brad Cadle
January 26th, 1999, 10:41 PM
Hi All,

Hi all. I am a begining java programmer. This is an extension on a previous message I posted under a different header. See the subject

"User supplied methods in classes" for specifically what I am trying to accomplish.


Basically I want to if there is a way to implement a specific method at runtime. In other words, I want to have essentailly an abstract method, but implement the abstract method at runtime without having to derive a new class from it. Is this possible and what is the best way to accomplish this.


-Brad

Zafir Anjum
January 27th, 1999, 12:15 AM
You cannot implement a method at runtime. Interfaces have been used quite liberally

for the kind of stuff you want. You might want to check out the chapter on interfaces

in "Thinking in Java" at


http://www.codeguru.com/java/tij/