Skip to content
Programming Updated Jul 2015

How To Read Data From .txt File Java

Published
Reading time
1 min read
Views
1.1k views
How To Read Data From .txt File Java

In this article you will learn Read Data From .txt File in Java Language Line by Line. This is very easy Step by Step program is written below.

        String str = null;
        try
        {
            BufferedReader in = new BufferedReader(new FileReader(filename));
            while ((str = in.readLine()) != null)
            {
                System.out.println(str+"\n");
            }
            in.close();
        }
            catch (Exception e) {
        }

Questions & comments

Did this work for you, or did you hit a different error? Ask below and we will help.

Comments are reviewed before they appear.

More like this

More in Programming

Programming

Easy Way To Draw Line On Image in JAVA

In this article you will learn how to draw line on an image in JAVA language. This is very easy way. You also can store this image in your System. BufferedImage img = new…

Programming

Change Color of An Image In JAVA

In this article we will learn how to Change Color of An Image In JAVA language. This is too much easy tutorial for beginners. BufferedImage img = new BufferedImage(600, 3…

Programming

How to Scrape and Process Data from Different Websites

There are many online tools available online that you can use to extract your desired data from different websites. But most of the time you are not able to get complex d…