Creation of Array

hi folks,

i need to create one array, which will be something like this ...

industry_value["Apparel"]="Apparel";

industry_value["Banking"]="Banking";

industry_value["Biotechnology"]="Biotechnology";

industry_value["Chemicals"]="Chemicals";

industry_value["Communications"]="Communications";

industry_value["Construction"]="Construction";

how can i create kind of this array ...

the index will be string, and value too will be array ...

please help me ...

with regards,

Gaurav Raj

[558 byte] By [gaurav8804@gmail.coma] at [2007-11-26 22:22:15]
# 1
String[ ] industry_value = {"val 1"," val 2"," val 3 "};industry_value[0] = industry_value[2];
abdulkareema at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...
# 2
I think you need HashMap
rym82a at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...
# 3
you can use a HashMap or a TreeMap.but what do u mean by "value too will be array "?
PurpleSkiesa at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...
# 4

hi ... every body ...

thanks for ur reply ... but i m very sorry to say ... i had done a really big mistake while posting my question ... and now i m rectifying it ...

the index will be string, and value too will be string ...

the value will be string, not array ...

industry_value["Apparel"]="Apparel";

industry_value["Banking"]="Banking";

industry_value["Biotechnology"]="Biotechnology";

industry_value["Chemicals"]="Chemicals";

industry_value["Communications"]="Communications";

industry_value["Construction"]="Construction";

how can i create kind of this array ...

the index will be string, and value too will be string ...

please help me ...

with regards,

Gaurav Raj

gaurav8804@gmail.coma at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...
# 5
> the index will be string, and value too will be string ...As has been said, for this you would use a Map.( http://java.sun.com/javase/6/docs/api/java/util/Map.html)
pbrockway2a at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...
# 6
If you don't know how to use Maps yet.You can do a quick google search on "map tutorial in java"This should help you very much. It helped me.
lethalwirea at 2007-7-10 11:20:35 > top of Java-index,Java Essentials,Java Programming...