Can you use an array of strings instead of individual strings? Use the
random number as an array index.
-Richard Yee
-----Original Message-----
From: B R Nair [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 25, 2000 11:55 AM
To: [EMAIL PROTECTED]
Subject: Macro Substitution
Hi,
Can any one tell me how is macro substitution done in Java?
Here is my problem:
I have 30 variables, namely:
String u1
..
String u30.
I have another variable namely
int randomNum
Value of randomNum varies between 1 and 30.
I wanted to assign some value to the variable u1 to u30 depending upon the
value of randomNum.
For example,
if (randomNum == 2)
u2 = 45;
if (randomNum == 5)
u5 = 73.
Here, the name of the variable can be constructed by
String str = "u" + Integer.toString(randomNum);
But how can I assign value to the resultant variable?
Thanks in advance
B R N.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets