java - How do I copy element which reference from int array >=40 to a new String array -
i have int
array , string
array of same length, , want create new string
array containing elements original string
array; elements @ positions int
on corresponding position in int
array less or equal 40.
public void check (int[]a,string []y){ string[]copy =new string[] for(int i=0,i=j,k;k<copy.length,i<a.length; i++,j++,k++){ if(a[i]>=50) y[j]=copy[k]
}
you need specify length of array.
i.e
string[] copy = new string[20]; <----
it helps use ; <---- @ end of each command. period in sentence...
i think might wanted:
public class inttostrng {
public static void main(string[] args) { int[] ints = {2, 3, 4,5, 6, 7,}; string[] stng = new string[ints.length]; for(int = 0; i<ints.length; ++) { stng[i] = integer.tostring(ints[i]); } }
}
Comments
Post a Comment