Did you like how we did? Rate your experience!

Rated 4.5 out of 5 stars by our customers 561

Award-winning PDF software

review-platform review-platform review-platform review-platform review-platform

Video instructions and help with filling out and completing Fill Form 8815 Filers

Instructions and Help about Fill Form 8815 Filers

What is going on guys? Welcome to your 81st Jeff tutorial. We are finally going to learn how to read stuff from a file. As you can already see, I created this Chinese.txt file and I added three more records to it. The first one is "Bucky", the second one is the ID number, and then a name. It has four records. A record is pretty much a row of data. Now, let's go ahead and figure out how to access the file from a Java program. Before, we used the scanner object to read from our keyboard using "System.in". However, we can also use the scanner to read from a file. So, let's make a private scanner variable. I'm going to name mine "scan". First, let's create a method to open the file. The method should be public and void. Let's put "try" to open the file. We're going to set "scan" as a new scanner. Instead of "System.in", we'll put "new File" and the name of the file. In this case, it's "Chinese.txt". If there are any errors, we'll catch them. After opening the file, let's print out a message saying "Good, file looks good enough". Now, let's create a method to read the data from the file. Again, the method should be public and void. First, we'll create a while loop that will loop until it reaches the end of the file. We'll use the method "hasNext" to check if there is more input to read from the file. Each record in the file has an ID number, a first name, and a last name. So, we'll create three variables to hold those values. We'll use "X.next" to assign values to the variables "a", "b", and "c". Then, we'll print out those variables using "printf" to format the output. Finally, we'll create a method...