Java #47: How to Read From a Previously Created File in Java

//The text file says “Welcome to your new file!”

It’s easier to understand how to read from files with the whole program, so the Java source code is below.

——————————————–Beginning of program——————————

//Programmer:Akinwale Owi
//Company: Dagba Computers
//Program Purpose:How to Read From A Previously Created File in Java

package dagbacomputers;


//Beginning of DagbaComputers (Class containing the Main function)
public class DagbaComputers

//Main Function
public static void main(String[] args) throws Exception
//Creating the FileReader
FileReader fileSurfer = new FileReader(“BrandNew.txt”);

//integer that will run through the file
int a;

//loop to print out contents of file
while((a =!=-1)

//Printing out each char of the file

//end of while

//Closing the File
//End of Main Function
//End of DagbaComputers Class

——————————————-End of Program————————————–

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s