textfiles

right, so ive got this problem, basically, ive got a bunch of text files and i want to use the scanner to go through every single file, and seperate every single word from all the text files, i tried everythnig, and ive scoured this forum my code looks like this:

In what parameter? Are we supposed to look over your shoulder at what you typed? You create a new Scanner instance for each file in a list (or any other collection). If you're getting errors trying to do that, you need to post your code and the exact error message.

By the way, my code fragment above used the wrong constructor form (it passed the string file name instead of a File object) and has been edited accordingly.

In what parameter? Are we supposed to look over your shoulder at what you typed? You create a new Scanner instance for each file in a list (or any other collection). If you're getting errors trying to do that, you need to post your code and the exact error message.

By the way, my code fragment above used the wrong constructor form (it passed the string file name instead of a File object) and has been edited accordingly.

Like Ezzaral said post your code and where you are getting the error. Also remove the throws Exception from the main. What would be the point of the method throwing an exception since no one will catch it. Also you need to add the catch (IOException ioe) { ... } after the try { .. }

Like Ezzaral said post your code and where you are getting the error. Also remove the throws Exception from the main. What would be the point of the method throwing an exception since no one will catch it. Also you need to add the catch (IOException ioe) { ... } after the try { .. }