title: Reading scanned words into an array using Scanner import in Java
body: <p>I have this code:</p>
  
  <pre><code>        Scanner input = new Scanner(System.in);
          System.out.println("Enter file name: ");
          File file = new File(input.nextLine());
          if (file.length() == 0) {
              System.out.println("The input file is empty.");
              System.exit(1);
          }
  </code></pre>
  
  <p>It reads the file that a user has typed in and then checks to see if it is empty or not, pretty simple. </p>
  
  <p>What I want to do is put each word from this file into a string array that will contain each word, punctuation and all (an apostrophe or a dash would be included as the word). How do I do this?</p>
  
  <p>We are assuming that the file contents may look something like this:</p>
  
  <pre><code>it's
  Stop
  
  the
  
  malformed yes-man
  </code></pre>
  
  <p>Just random words either separated by returns or spaces.</p>
  
  <p>Your help would be much appreciated :)</p>