I want to get a random word from the ArrayList in the method getRandom. My ArrayList is loaded from a file. I am then going to use this word in a hangman game. So I would like it to be printed like *****
import java.util.*;
import java.io.*;
public class Application {
    private ArrayList<Pirateword> piratewords;
    private Scanner input;
    public Application(){
        input=new Scanner(System.in);
        piratewords=new ArrayList<Pirateword>();
    }
    public void runApplication() throws IOException {
        String response;
        String w;
        do {
            load("piratewords.txt");
            save("piratewords.txt");
            response=input.nextLine();
    } while (!((response.equals("q")|| (response.equals("q")))));
        System.out.println("Thank you for playing");
    }
    public void load(String fileName) throws IOException{
        Scanner infile =new Scanner(new InputStreamReader(new FileInputStream(fileName)));
        int num=infile.nextInt();infile.nextLine();
        for (int i=0;i<num;i++) {
            String w=infile.nextLine();
            Pirateword p=new Pirateword(w);
            piratewords.add(p);
        }
        infile.close();
    }
    public void save(String fileName) throws IOException{
        PrintWriter outfile = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName)));
        outfile.println(piratewords.size());
        for (Pirateword p:piratewords) {
            outfile.println(p.toString());
        }
        outfile.close();
    }
    public void getRandom() {
}
}
 
     
     
    