Public static void main(String[] args){
char[] ch = {'3 ',' 5 ',' 2 ',' 4 ',' 0 ',' 8 ',' 1 ' };
int[]toInt = new int[ch . length];
for(int I = 0; I & ltch. Length; i++){
toInt[I]= integer . parse int(string . value of(ch[I]));
system . out . print(toInt[I]);
}
}
}
My program is correct, but why is yours wrong? The reason is that int[] a={} Here, the space you allocated to array A is 0, so how can it store 7 numbers? It should be written as follows: int [] a = new int [7]; Or int [] a = new int [ch. length]; Hmm. How interesting ..