Re: Creating an object during runtime



On Tue, 29 Nov 2005 22:15:36 +0000, zero wrote:

>
> If you want to create objects at runtime you need the reflection api.
> For example, to create a new object of class C2:
>
> Class classDefinition = Class.forName("C2");
> Object object = classDefinition.newInstance();
>
> Here object will be an instance of C2.

Just to nitpick: You create all your objects at runtime, no matter if you
use reflection, or not.

Back on topic:

As far as i can see, the original author wants to create _classes_ at
runtime, for which there are some libraries available, but nothing in the
standard API... though i doubt that this is the solution to the OPs
question. Some more details about what he is trying to do (as opposed on
how he tries to do it) might help.

--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"


.