Set random line from text file

I have a program where I want to display a random line on a label then once an action is performed, display a new one. I know how to read the contents of the file, but sure how to display a random line. Also, once a line has been shown, I don’t want the same line to be shown again. I’ve seen many suggestions talking about ‘arrays’, ‘lists’ and ‘arraylists’. I’m a bit of a novice in this area and would appreciate some help. Thanks.


Source: java

Leave a Reply