The line read is in the strLine variable. Since you have already defined your array, you can simply put that value inside the array. Of course within each while-loop run you will need to increase the index of the array so you will put the next line to the next element of the array.
Create a public method that takes as argument an int and returns the element of the array at that place, and call it from main. You need to do that because you have defined the array asprivate which I think is a good idea.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
You do not need that "for" loop.
My suggestion is to just initialize a counter example :-
"lineCounter=0", just before the "while". And in the "while" block just put the following line :-
a[lineCounter++] = strLine;
That should do it.
Shucks I guess javaAddict beat me to it.
stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154