title: Cannot resolve method 'split' in 'String'
body: <p>I am trying to read a file and split all the words into separate Strings.</p>
  <p>This is my code:</p>
  <pre><code> public String[] words(String fileName) throws Exception {
      BufferedReader reader = new BufferedReader(new FileReader(fileName));
      String word;
      String[] words;
      ArrayList&lt;String&gt; wordList = new ArrayList&lt;&gt;();
      while ((word = reader.readLine()) != null){
          words = word.split(&quot;\\s&quot;);
          for (String string : words)
              wordList.add(string);
      }
  
      return (String[]) wordList.toArray();
  }
  </code></pre>
  <p>For some reason the line:
  <code>words = word.split(&quot;\\s&quot;);</code>
  is causing an error &quot;Cannot resolve method 'split' in 'String'&quot; but I have no idea why.</p>