我在我的java类中创建了一个函数,比如assignval(int i)。在这个函数中我需要创建动态变量,例如当int值为1时。我应该有
String []data_value1 =data1.split(",");
String []key_value1 =key1.split(",");
which i am reading from property file.
when int value is 2
String []data_value2 =data2.split(",");
String []key_value1 =key1.split(",");
等等
我怎样才能实现这一点。
我尝试了下面的代码,但它有效:
String assignval(int i){
Sting [] data_val+" "+i=DATA+" "+i.split(,)
String[] key_values+" "+i = key+" "+i.split(",");
}
我正在从属性文件中读取DATA。
property file:
DATA1=abc,def,ghi
DATA2=jkl,mno,pqr
key1=name,date
key2=place,address
so on
thanks in advance.