Hello Michael, Wednesday, April 2, 2003, 2:24:21 PM, you wrote:
MN> i will pay $2 usd if you can solve my problem. i'll send check by mail or MN> paypal. MN> my problem is i have a String variable s which stores the name of the MN> instance i want to create. how do i convert that variable to java code so MN> that i can use it in my java code. MN> for instance MN> this is what i want to do MN> blue.use(); MN> red.use(); MN> but have somethign like MN> s = "blue"; MN> something(s).use(); MN> s = "red"; MN> something(s).use(); MN> which does the samething as above MN> mike MN> _________________________________________________________________ MN> Protect your PC - get McAfee.com VirusScan Online MN> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 MN> --------------------------------------------------------------------- MN> To unsubscribe, e-mail: [EMAIL PROTECTED] MN> For additional commands, e-mail: [EMAIL PROTECTED] Constructor constructor = Class.forName(yurStringValue).getConstructor(new Class[] {/*base class constructor parameters types*/}); yuorInstance = (YourInctanceBaseClass)constructor. newInstance(new Object[]{/*constructor parameters*/}); -- Best regards, Serges mailto:[EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
