The method split(String) is undefined for the type Scanner
<p>Why is it that I cant use split method on <code>input</code>? In Eclipse it says: The method split(String) is undefined for the type Scanner. I dont know what I am doing wrong, if anyone could guide me in the right direction.</p>

<pre><code>btnFile.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent arg0) {

        JFileChooser chooser = new JFileChooser("C:\\");
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        FileNameExtensionFilter filter = new FileNameExtensionFilter(
                " Only .txt", "txt");
        chooser.setFileFilter(filter);

        int code = chooser.showOpenDialog(null);
        if (code == JFileChooser.APPROVE_OPTION) {
            File selectedFile = chooser.getSelectedFile();
            Scanner input;
            try {
                input = new Scanner(selectedFile); // &lt;-- Here
                String[] splits = input.next().split(" "); &lt;-- And here

                for (int i = 0; i &lt; splits.length; i++) {
                    textArea.setText(splits[i]);
                    System.out.println(splits[i]);
                }
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
});
</code></pre>

<p>Thanks.</p>
