0

How I read from file into array ?

How I read from file and convert string to int ___ INPUT FILE : 9 DescArrayCheck 112;104;52;32;12;10 DescArrayCheck 12;14;52;132;212 DescArrayCheck 52;13;21;3 DescArrayCheck 14 DecToHex 4253 DecToHex 314 Noccurrences ababababb bab 2 Noccurrences 2121221222 212 5 Noccurrences yyyyyy yyy https://code.sololearn.com/c9UA8wLDm0t9/?ref=app

18th Oct 2020, 6:15 PM
SH S
SH S - avatar
1 Respuesta
0
I think it works but you have a mistake that in loop you defined x but using i. In this for (int x = 0; x < size; x++) { intg[i] = Integer.parseInt(arr[i]); System.out.print(intg[i] + " "); } //close here.. If it is not parable that aba.... Values then it throws Exception. How you handle there? And after splitting with ';', may there be spaces so apply trim for arr[i] elements also.....
18th Oct 2020, 11:01 PM
Jayakrishna 🇮🇳