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.
I've gotten this far but not sure how to do the 'random' part...
BufferedReader in = new BufferedReader(new FileReader("lines.txt"));
String str;
List<String> list = new ArrayList<String>();
while((str = in.readLine()) != null){
list.add(str);
}
String[] stringArr = list.toArray(new String[0]);