So i'm working on a java program where I ask for a file name, read it into an array. My problem is that im using a string tokenizer to delimit my commas and that put the student information into an array object.
I have 10 arrays that are supposed to be filled with first and last name and student id
my problem is that I keep getting an error code with my string tokenizer
import java.util.StringTokenizer;
import java.io.*;
import java.util.Scanner;
public class StudentD
{
public static void main(String[] args) throws IOException
{
Scanner in = new Scanner(System.in);
System.out.println("What is the File Name");
String file = in.nextLine();
File inputFile= new File(file);
Scanner input= new Scanner(inputFile);
String fName;
String lName;
String major;
int idNumber;
int counter=0;
Student [] info = new Student [10];
while(input.hasNext())
{
String line =input.nextLine();
StringTokenizer strTokenizer = new StringTokenizer(line, ";" );
while(strTokenizer.hasMoreTokens())
{
fName= strTokenizer.nextToken();
}
while(strTokenizer.hasMoreTokens())
{
lName= strTokenizer.nextToken();
}
while(strTokenizer.hasMoreTokens())
{
major= strTokenizer.nextToken();
}
while(strTokenizer.hasMoreTokens())
{
idNumber= Integer.parseInt(strTokenizer.nextToken());
}
}