TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java - dynamically generate variable names



Java
 

I am trying to dynamically generate an unknown amount of new variables, all with different names e.g. b1 b2 b3 b4, within a for loop. My current attempt is this
 

                                                // for loop to get parameters
                                        for(int i = 1; i <=20; ++i)
                                        {
                                         String kwdph + String.valueOf(i) = parser.getStringParameter("phrase" + i);
 
                                          if ( kwdph + String.valueOf(i) == null)
                                                        break;

                                        } // end of for
 

But obviosly it doesn't work. Does anyone know of any other way of doing this? Thanks.

Erick

-- 
_______________________________________________

Erick Stohr - PageLab Network, Inc.
mailto:erick@pagelab.net  http://pagelab.net

Your search-to-sale global e-commerce solution!

Toll free 1-800-447-0607
Voice 612-362-9224
Fax 612-362-9227
43 Main Street SE, Suite 228
Minneapolis, Minnesota 55414
_______________________________________________