Re: Creating an object during runtime
- From: Stefan Schulz <terra@xxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 00:36:00 +0100
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"
.
- References:
- Creating an object during runtime
- From: Peter Jones
- Re: Creating an object during runtime
- From: zero
- Creating an object during runtime
- Prev by Date: Re: checking casts
- Next by Date: Re: A good text editor for JAVA?
- Previous by thread: Re: Creating an object during runtime
- Next by thread: POST request as image url
- Index(es):