Im trying to read a line of file that has words and numbers in it and save it into a array
The file reads:
Barrett Edan 70 45 59
Part of the code that has a problem:
** let it be known that field was declared as a string array earlier in the code**
String [] fields = new String[100];
int [] numfields = new int[100];
while (reader.hasNext()) { //while reader reads a line
line = reader.nextLine(); //line reads reach line of file
fields = line.split("\t"); //splits line by tab space and saves it into fields
last[count] = fields[0]; // saves first word to first element of array
first[count] = fields[1]; //saves second word to second element
numfields[0] = fields[2]; /* THE PROBLEM: now i expected the 3rd word (70) of fields to be able to save into numfields array , but thats when i get cannot be converted to int error
numfields[1] = fields[3];
numfields[2] = fields[4]; */