I'm using this method to read records from a file in my root project directory, storing them into an array of objects.
example of a line of text:
Texas Austin TX19759614Southwest 5
this is the method i'm using:
public void readStates() { File file = new File("States.Fall2009.txt"); try { Scanner console = new Scanner(file); Scanner lineTokenizer; int lineNum = 0; while (console.hasNextLine()) { lineTokenizer = new Scanner(console.nextLine()); lineNum++; if (lineTokenizer.hasNext()) a[lineNum].name = lineTokenizer.next(); else { System.out.printf("line %d: State field is invalid", lineNum); continue; } etc...etc...etc...
can anyone help me out with this?