Campbell Ritchie wrote:You should have used the code button; I have gone back to your code and used it, and you can see how much better it looks.
What’s a 2D array? It doesn’t exist in Java. What you have is an array of arrays, which is actually better than a 2D array.
How do you know your array will have 154 elements? If you only have 153 lines, you are going to run out of lines. The 154th will be null if you use a BufferedReader.
How do you know each line will have 13 elements? Why, if you are splitting the line to get an array, don’t you simply reassign the line to the corresponding element of the outer array?
Why have you got your little text file in the root directory of C?
Why does your matrix contain only Strings? I though a matrix contained numbers?
Have you come across the syntax to test whether a line is null? It is peculiar and you would never guess it in 100 years:-
I'm not sure if this is how I reply, but here it goes:
I'm a NOOOOBIE-- didn't know about the code button, will use if from now on.
My 2D array has a fixed number of 153 rows and 13 columns, each consisting of FP numbers (I'll convert them later-- for simplicity I just wanted to see if I could read in the array). I know the 154 element is null, that's why I'm trying Buffered Reader with an Exception.
I'm not sure what you mean by an "outer" array. In VB and before, you had arrays of the type (xx,yy), so the "array of arrays" is confusing. I will have a lot of data (.txt) files in an (xx,yy) arrangement to read in.
The text file with the data of the array being read is on the root directory for simplicity, as I am trying different permutations and the directory seems to change with each change in code-- it's so I know it will read and not get kicked back for "not found". I'll work on keeping it in the correct directory later.
Yup, I know about the null, but I thought the BR with Exception did the same thing.
So, I'm still not sure why the last 2 lines of code aren't run--???
Thanks,
Ken