GENERIC NAME OF PARAMETER

Hello,

I would like to declare a variable number of parameters and the solution I've found is to make the name of my parameters generic

For exemple when I want n parameters I would like to do this:

int i=0;

String var+i="value1"; (> var+i in this step would be : var0

i++;

String var+i="value2"; (> var+i in this step would be : var1

.

...

i++;

String var+i="valuen"(> var+i in this step would be : varn

Thank you for your help.

F.S

[522 byte] By [javasmifa] at [2007-9-28 5:40:42]
# 1
> Thank you for your help.My pleasure.By the way, have you heard of List?
YATArchivista at 2007-7-9 16:51:35 > top of Java-index,Other Topics,Algorithms...
# 2
You could also look into using arrays.
DrClapa at 2007-7-9 16:51:35 > top of Java-index,Other Topics,Algorithms...
# 3
//a simple example of an arrayString[] var = new String[n];int i = 0;var = "value1";i++;var[1] = "value2";i++;....i++;var = "valuen";
Sulthana at 2007-7-9 16:51:35 > top of Java-index,Other Topics,Algorithms...
# 4
//again, without errors//a simple example of an arrayString[] var = new String[n];int i = 0;var [ i ] = "value1";i++;var[ i ] = "value2";i++;....i++;var[ i ] = "valuen";
Sulthana at 2007-7-9 16:51:35 > top of Java-index,Other Topics,Algorithms...