Results 1 to 2 of 2
Thread: Reading lines into 2d array
- 09-28-2011, 02:07 PM #1Member
- Join Date
- Jun 2011
- Rep Power
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?
- 09-28-2011, 03:53 PM #2
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.
- By gkoef in forum New To JavaReplies: 6Last Post: 04-20-2011, 12:08 AM
- By luxurymode in forum Advanced JavaReplies: 1Last Post: 03-30-2011, 09:18 AM
- By subith86 in forum New To JavaReplies: 6Last Post: 02-26-2011, 10:56 AM
- By j187 in forum New To JavaReplies: 1Last Post: 12-17-2010, 01:43 AM
- By ivvgangadhar in forum New To JavaReplies: 8Last Post: 01-12-2009, 09:53 AM