Please help me to creating dynamic VARIABLE in java, with predefined name.
creating dynamic VARIABLE in java
Collapse
X
-
Originally posted by Bora JiPlease help me to creating dynamic VARIABLE in java, with predefined name.
in which you store the associations between names and values.
kind regards,
Jos -
create the variable name with a concat with the loop counter variable name to get the
HOW TO DO THIS ?
//Variable Declaration
String col_width_1 = "100px";
String col_width_2 = "150px";
//etc String col_width_N = "XXXpx";
//loop
for (int h = 0; h < hrecset.getRowC ount(); h++)
{
//some code
//create the variable name with a concat with the loop counter variable name to get the value of the concatened variable
out.println("<t d style=\"width: "+col_width_+h+ " \">")//Do you understand what i mean?
//some code
}Comment
-
Don't use this .. because every time the system executes hrecset.getRowC ount().
Instead use,
Code:int rowCount = hrecset.getRowCount(); for (int h = 0; h < hrecset.getRowCount(); h++) { //some code }
Comment
Comment