Reading data from a file using FileInputStream
First, we should attach a file to a FileInputStream as
FileInputStream fin = new FileInputStream(“file.txt”);
we should read data from the FileInputStream as
Then we should attach the monitor to some output stream, so that output stream will send data to the monitor.
Finally, we read data from the FileInputStream and write it to System.out