Question

i want select value in the array

how?

this is my code:

String[] str = {"1Farzad","2abbas","3ali","4hasan","5ajjad"};

for (String s:str) {
    builder.append(s);
    builder.append(" ");
}

for example how select "3ali" with 2 index?

Était-ce utile?

La solution

Try doing it like this.

str[2]

Also, seems like you want this kind of loop.

for (int i=0; i<str.length; i++) {
    String s = str[i];
    builder.append(s);
    builder.append(" ");
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top