An exercise for using the FileReader class to input data from a data file

 

FileReaderDemo.java

 

Samples running the program:

·        Using JDK

FileReaderDemoJDK.JPG

 

·       Using Java NetBeans

1.      Error message (if the working directory is not set up right)

FileReaderDemoNB.JPG

2.      To set the working directory to where the program/data file is:

FileReaderDemoNB_SetConfig.JPG

FileReaderDemoNB_SetConfig_WorkingDirectory.JPG

 

3.      Finally, the program runs and displays the content of the program file.

FileReaderDemoNB_Output.JPG