-1

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?

David Brossard
  • 13,584
  • 6
  • 55
  • 88
Harjit Singh
  • 905
  • 1
  • 8
  • 17
  • "but I failed" doesn't tell us anything about what went wrong. Hint: you're not changing `m` anywhere in your loop... (That's just a matter of not looping properly; it has nothing to do with the body of your loop.) – Jon Skeet Apr 27 '14 at 06:49

1 Answers1

2

You forgot m++;

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

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

 }
Jeff Ward
  • 1,109
  • 6
  • 17
Braj
  • 46,415
  • 5
  • 60
  • 76