I miss something and I will appreciate your help I have this array for a combobox
String array [] = {"aa", "bb", "cc"};
and I have this for loop to run all over the array
for(String s: array) {
if(s.equals(array[0]) {
do something
}
}
Now what I need is that, I need the "do something" to happen to each element in the array only when the element is selected by the combobox, my array is so long and I can't write if statement for each element in the array.
what I want is something like that
for(String s : array) {
if(s equals the array elements) {
substring the first index of each element
print s
so result let's say will be like this
a ----> if only element a is selected
b ----> if only element b is seleceted
etc ...
}
}
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire