- 2
How do I replace an array element with three elements without using another array? eg. Replace '0' by $,£,&
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
+ 1
is it possible if the length is not defined or some indexes contains null value?
0
you cannot do it, because an array has fixed size