File Reader/Storing Token - Urgent
Hello, I am new to forums and i'm doing a school project. I have some troubles understanding tokenziers and file reader. Professor gave us code that will read a file for us and get the information we need the only problem is storing this information in a two dimensional array.
Here is the code for reading a file and separating them into tokenz. My only problem is storing each word in a two dimensional array. When i have tried my way I keep getting error.
Code:
public static void main(String args[]) throws Exception
{
File inputFile = new File("course_list.txt");
Scanner input = new Scanner(inputFile);
while(input.hasNextLine())
{
String line = input.nextLine();
line.substring(0, line.indexOf(","));
StringTokenizer str = new StringTokenizer(line, ", ");
while(str.hasMoreTokens())
{
System.out.println(str.nextToken().trim());
}
}
}
When I run the code it prints out each word as it is suppose to I just need to store each word in a two dimensional array so can anyone help me out and provide the code that I require for it to work?