Please could sum1 help me with this:

I'm trying to read text from a file using the Scanner class and i'm not sure y its not throwing the FileNotFound Exception


Scanner sc = new Scanner (new File ("Food.txt"));
wordList[num] =;

wordList[num] =;

catch ( FileNotFoundexception f)
System.out.println("Cannot find the file");


Recommended Answers

All 2 Replies

Probably because the file does not exist.
And you could use BufferedReader for reading from file.

I found what i did wrong, bt thank u 4 th help

commented: Read the forum rules on "chat speak". If you can't write intelligently, don't expect an answer. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.