Pergunta

Suffixing of each array member by the same suffix (.wav) is required as:

String []  a = {"one", "two", "three"};
String str = ".wav"

Required output :

String[] a ={"one.wav", "two.wav", "three.wav"};

I tried to achieve this in the following way:

int m;

     for (m=0; m<a.length ;) {

        a[m]= a[m] +str  ;

     }

but I failed. What should I do to achieve the required output?

Foi útil?

Solução

You forgot m++;

for (m=0; m<a.length; m++) {

    a[m]= a[m] + str;

 }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top