Lesole Mphinyane wrote:pliz help..
Please use real words when posting to the forums. Abbreviations such as "pliz" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses.
Please read this for more information.
So you could read each line of the file into an ArrayList. Then when you generated the random number you access the line from the ArrayList.
Bear Bibeault wrote:Sure. You could use an array. But that would likely be wasteful and inefficient and prone to error unless you know in advance how many lines to read.
What's your beef with ArrayLists?
its not that i have beef with ArrayLists, i cant learn them now.. will try to use the LineNumberReader. how is it
Lesole Mphinyane wrote:
its not that i have beef with ArrayLists, i cant learn them now..
What have you been doing for the last hour. It only takes 5 minutes to learn how to use them.
Or you could continue to waste time by trying to use a LineNumberReader, which won't work either.
As for how List and ArrayList work, it's really simple. In pseudo code:
For more information, read this.