by Dinesh Thakur Category: Stream

FileInputStream is a is present in package and is the child class of InputStream class. It reads data in the form of bytes from a text file.

FileInputStream file = new FileInputStream("Hello.txt") ; Here file is the object of FileInputStream class and points to "Hello.txt" file and if the file is not present then program is terminated by generating fileNotFoundException.

Read data from the file.

Here is the Java Example for Reading Data From File:


class ReadDataFile
           public static void main(String args[])
                 FileInputStream file=new FileInputStream("Hello.txt");
                 System.out.println("Show the File Contents ");
                 int ch;
                 catch(IOException e) {}

Reading Data From File

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles