title: Java - File being read returns null
body: <p>Hi I am loading a file into my program and assigning each value (stored on a new line to a array) I cant seem to spot why the array holding the file content is null in each index.</p>
  
  <pre><code>    private void readAndProcessWords() {
      try {
          FileReader _fr = new FileReader(FILEPATH);
          BufferedReader textReader = new BufferedReader(_fr);
  
          int numLines = getNumLines(textReader);
          String[] words = new String[numLines];
  
          for(int i=0;i&lt;numLines;i++){
              words[i] = textReader.readLine();
              System.out.println(words[i]);
          }
          //clears memory reserved for this buffered reader
          textReader.close();
  
      } catch(IOException e) {
          System.out.println(e);
      }
  }
  
  private int getNumLines(BufferedReader textReader) throws IOException{
      String line;
      int numLines =0;
  
      while((line = textReader.readLine()) != null){
          numLines++;
      }
      return numLines;    
  }
  }
  </code></pre>
  
  <p>Solution: add the below code above the loop to 'reset' the file reader</p>
  
  <pre><code>_fr = new FileReader(FILEPATH);
          textReader = new BufferedReader(_fr);
  </code></pre>