Login
register search gameSlave

JAVA Help please.
Re0sLess

User Avatar
Posts: 2103
Rank:
Forum rank 5 out of 5
Joined: 09 Sep 05
15 November 2005 13:14 Reply (Quote this message)
So i'm trying to do my Java homework and i'm stuck, and i'm hopping there are some budding java programmers here to point me in the right direction

what i'm trying to do is read in a text file using the FileReader.

the file is a coma seporated file, and each line has 5 values, so i read it in split it by the comma and store it in a multi-dimsonal array.

this is not the problem, as its the same as VBasic . the problem is knowing how big the file is (line wise).

at presant i am decering an array as follows

String flightArray = new String[5][30];

but if there is more then 30 lines the file i loose values as my loop loops till the end of the larger arrays length

so here my problem

in VBasic there is "Redim preserve" theat lets you resize your array mid program. is there anything like this in Java? or is there a line counter for files?

if not then my only other alternitive is to open the file twice once to count the lines and once to read the lines once thhe array hass been sized but thats messy.

thanks in advance


Forum Home \ Hardware/Software Support New Thread New Reply