How to read txt files in java SE

When using java you may want to read text files. Java is a slow language but very powerful.
Here is how

What this does is it reads a text file. Let me explain the whole script.
Import the Scanner to read Files and the File class to talk to files in the first place. Make an object of the File from the File name and the File class. Then make a scanner object for the previous object. This allows you to read,close and check for the next line in a text file.
Then you make a while statment to see if a nextline is in the file. If so then it would read the next line and print that line out. This would occur until there is no next line in the text file. When that occurs, the file is closed and the program ends. Ask me for any questions or concerns.

You are viewing a single comment. View All

Doesn't work at all.

I've been trying to read in a simple text file (which exists right in my project) and I get a filenotfoundexception error.