سؤال

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?

هل كانت مفيدة؟

المحلول

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(" ");
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top