title: Displaying a randomly selected line from a .txt document in java
body: <p>I have a .txt document that holds a list of words, one word on each line. There are ten lines. How do I read this document, pick a random line from it, and have that word displayed?</p>
  
  <p>This is the code that I have so far:</p>
  
  <pre><code>    Scanner fileScan, wordScan;
      String word;
      Random rand = new Random();
      int pickedLine = rand.nextInt(6)+1;
  
      fileScan = new Scanner(new File("list.txt"));
  
  
      while (fileScan.hasNext()) {
          word = fileScan.nextLine();
          System.out.println()
  
      }
  </code></pre>