Question

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?

Was it helpful?

Solution

You forgot m++;

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

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

 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top