Reading lines into 2d array
I need to read a textfile line by line into a two dimensional array.
The array would be an array of strings. I'm thinking to use an arraylist of type string
The string is always two words and the text file contains 15 lines of two word strings.
How do I do this? Can I declare an arraylist of type String and then use the string split method ?
IF so, how do I get the split string elements into the array?
Re: Reading lines into 2d array
Do you want the data in a 2 dim array or in an ArrayList?
If an array, would each row hold two columns of the data from each file record?
The split method would be useful to parse the line into an arrray of two Strings that could be assigned to each row of the 2 dim array.