What is the method to check next word? Java?

Jay Mozart

New member
File file = new File(fileName);
Scanner scan = new Scanner (file);
while(scan.hasNextWord()) {
}

Is there such thing as hasNextWord()?

I need to store each word on specific text file and store them as array and print them out individually.
For example, if hello.txt contains --

Hello, my name is John.

Then array[0] = Hello,
array[1] = my
array[2] = name
... etc

Thanks!
 
Back
Top