- 2

How do I replace an array element with three elements without using another array? eg. Replace '0' by $,£,&

4th Jul 2016, 12:08 PM
Rohan Agrawal
Rohan Agrawal - avatar
3 Respuestas
+ 3
you can replace array element but one at a time eg. String[] a={"1","0","3","0","5"}; for(int i=0 ;i<a.length;i++) { if(a[i]=="0") { a[i]="&"; } } after replacement a=1,&,3,&,5
5th Jul 2016, 6:41 AM
Dhananjay Chavan
Dhananjay Chavan - avatar
+ 1
is it possible if the length is not defined or some indexes contains null value?
4th Jul 2016, 5:08 PM
Rohan Agrawal
Rohan Agrawal - avatar
0
you cannot do it, because an array has fixed size
4th Jul 2016, 5:05 PM
Igor Q