I am new to Java and stackoverflow. I have a text file that I wish for my Java program to read and then pick a random line and display it. What I've found only demonstrates bytes and characters. How can I use strings or just a line? I apologize that this question has been asked before, but other posts have not helped me. I'm at a loss and I feel like there's a simple solution for this.
Here's what I have so far:
package Nickname;
import java.util.Scanner;
import java.io.*;
public class Nickname {
public static void main(String[] args) throws IOException {
RandomAccessFile randomFile = new RandomAccessFile("names.txt", "r");
}
}