Reading file into array. PLEASE HELP! :)
Hi everyone. I'm very new to programming. I have a file titled AwardYears.txt and need help reading the file into an array. I have the code for everything else I need to do with the array, I just don't know how to input it from the file.
The text file looks like this:
Award Winners from 1990 to 2010
John Smith 1999 2000 2009 2010
John Doe 2000 2001 2002
Jane Doe 2001 2004 2005
Bob Angelo 1992 1995 2002
I need to input the names into name variables and the dates into date variables. Any advice on how to do this?
Re: Reading file into array. PLEASE HELP! :)
To get started reading from a file I suggest one of these:
Scanner (Java 2 Platform SE 5.0)
BufferedReader (Java 2 Platform SE 5.0)
Although, I am partial to the Scanner class, both work nicely. Now, without knowing whether you are going to just use a one dimensional array of type String to hold the data or something more object oriented, I can't really help much more than that. When you say "name variables" and "date variables" it is impossible to deduce if you are suggesting there is a name class and a date class or if they are just Strings. Showing the code that you have so far could help out a bit.