Whilst I can get it to work on a 1 dimension array (String array[] = str.split(blah)
), I have trouble on 2D arrays. I'm using a loop that goes through each row of the 2D array and assigns it whatever str.split(\t)
has.
For example:
John\tSmith\t23
James\tJones\t21
My 2D array will look like this: {{John, Smith, 23}, {James, Jones, 21}}
I've only begun Java so I'm not too sure about some of the syntax for 2D arrays.
EDIT: Some code as requested
String str;
int row = 0;
String array[][];
while ((str = br.readLine()) != null) {
array[row] = str.split("\t");
System.out.println(array[row][0]);
row++;
}