-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can always go ahead and create the object...if you don't use it,
Java will do garbage collection on it. However, it's a bit sloppy
coding. You can always wrap your object in an if statement (like in a
menu)

if(menu.option == 1)
        Object obj = new Object();

This exposes all of the methods for that object (similar to your
snippet).

Wayne

PGP Key @ http://pgp.mit.edu/ 
- -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Brian Kotek
Sent: Monday, May 10, 2004 10:06 AM
To: [EMAIL PROTECTED]
Subject: [CFCDev] OT: Dynamic class instantiation in Java?

Off topic but I thought someone here might know the answer.  Is it
possible to dynamically instantiate a class in Java?  Similar to how
you
could do:

<cfset myObjVar = "someComponent" />
<cfset myObj = createObject( 'component', '#myObjVar#' ) />

In other words, to instantiate a class in Java when you won't know
until
runtime what class you want to instantiate?


Thanks,

Brian

- ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBQJ+O3FuRxBfF5S5XEQIImACeLUNDcLDq/sv7HGWn4x2hABbGYXwAoMHo
/5ggDwlVwwMJaneLUN8wAoBB
=qWKh
-----END PGP SIGNATURE-----

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to