May I suggest you have a look at the Java Reflection package... java.lang.reflect also the java.lang.Class class, class.forName() will be of interest to you.
> -----Original Message----- > From: Michael Ni [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 02, 2003 12:24 PM > To: [EMAIL PROTECTED] > Subject: instance names problem will pay $2 for solution > > > i will pay $2 usd if you can solve my problem. i'll send > check by mail or > paypal. > > my problem is i have a String variable s which stores the name of the > instance i want to create. how do i convert that variable to > java code so > that i can use it in my java code. > > for instance > > this is what i want to do > > blue.use(); > red.use(); > > but have somethign like > s = "blue"; > something(s).use(); > s = "red"; > something(s).use(); > > which does the samething as above > > mike > > > _________________________________________________________________ > Protect your PC - get McAfee.com VirusScan Online > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
